AshFormBuilder.Field (AshFormBuilder v0.4.0)

View Source

Represents a single form field declared via the field DSL entity.

Relationship Fields

When a field represents a relationship (e.g., many_to_many), the following fields are populated:

  • :relationship - The relationship name (atom)
  • :relationship_type - The type of relationship (:many_to_many, :has_many, etc.)
  • :destination_resource - The related resource module
  • :opts - Custom options for UI components (search events, preload options, etc.)

Types

  • :text_input - Standard text input
  • :textarea - Multi-line text area
  • :select - Single-select dropdown
  • :multiselect_combobox - Many-to-many searchable multi-select (MishkaChelekom combobox)
  • :checkbox - Boolean checkbox
  • :number - Numeric input
  • :email - Email input
  • :password - Password input
  • :date - Date picker
  • :datetime - DateTime picker
  • :hidden - Hidden input
  • :url - URL input
  • :tel - Telephone input
  • :file_upload - File upload (bridged to Phoenix LiveView allow_upload)

Summary

Types

t()

@type t() :: %AshFormBuilder.Field{
  __spark_metadata__: map() | nil,
  accept: :any | [String.t()] | String.t() | atom() | nil,
  auto_upload: boolean() | nil,
  autocomplete: String.t() | nil,
  autofocus: boolean(),
  bucket: String.t() | nil,
  class: String.t() | nil,
  cloud: module() | nil,
  description: String.t() | nil,
  destination_resource: module() | nil,
  disabled: boolean(),
  hint: String.t() | nil,
  inputmode: String.t() | nil,
  label: String.t() | nil,
  max: number() | String.t() | nil,
  max_file_size: pos_integer() | {pos_integer(), atom()} | nil,
  max_files: pos_integer() | nil,
  maxlength: pos_integer() | nil,
  min: number() | String.t() | nil,
  name: atom(),
  options: list(),
  opts: keyword(),
  pattern: String.t() | nil,
  placeholder: String.t() | nil,
  prefix: String.t() | nil,
  readonly: boolean(),
  relationship: atom() | nil,
  relationship_type: atom() | nil,
  required: boolean(),
  rows: pos_integer() | nil,
  step: number() | String.t() | nil,
  suffix: String.t() | nil,
  type:
    :text_input
    | :textarea
    | :select
    | :multiselect_combobox
    | :checkbox_group
    | :checkbox
    | :toggle
    | :number
    | :email
    | :password
    | :date
    | :datetime
    | :hidden
    | :url
    | :tel
    | :file_upload,
  wrapper_class: String.t() | nil
}