# `PhoenixFilament.Field`
[🔗](https://github.com/franciscpd/phoenix-filament/blob/main/lib/phoenix_filament/field.ex#L1)

A plain data struct representing a form field declaration.

Each field has a name (matching an Ecto schema field), a type
that determines which input component renders it, an auto-humanized
label, and a keyword list of type-specific options.

## Supported Field Types

  * `:text_input` — single-line text input
  * `:textarea` — multi-line text input (opts: `rows`)
  * `:number_input` — numeric input (opts: `min`, `max`, `step`)
  * `:select` — dropdown select (opts: `options`)
  * `:checkbox` — boolean checkbox
  * `:toggle` — boolean toggle switch
  * `:date` — date picker
  * `:datetime` — datetime picker
  * `:hidden` — hidden field

## Common Options

  * `required: true` — UI hint only (shows asterisk). Real validation is in Ecto changeset.
  * `label: "Custom"` — overrides auto-humanized label
  * `placeholder: "..."` — placeholder text

# `field_type`

```elixir
@type field_type() ::
  :text_input
  | :textarea
  | :number_input
  | :select
  | :checkbox
  | :toggle
  | :date
  | :datetime
  | :hidden
```

# `t`

```elixir
@type t() :: %PhoenixFilament.Field{
  label: String.t(),
  name: atom(),
  opts: keyword(),
  type: field_type()
}
```

# `checkbox`

```elixir
@spec checkbox(
  atom(),
  keyword()
) :: t()
```

Creates a `:checkbox` field.

# `date`

```elixir
@spec date(
  atom(),
  keyword()
) :: t()
```

Creates a `:date` field.

# `datetime`

```elixir
@spec datetime(
  atom(),
  keyword()
) :: t()
```

Creates a `:datetime` field.

# `hidden`

```elixir
@spec hidden(
  atom(),
  keyword()
) :: t()
```

Creates a `:hidden` field.

# `new`

```elixir
@spec new(atom(), field_type(), keyword()) :: t()
```

Creates a new Field struct. Label is auto-humanized from `name` unless provided in `opts`.

# `number_input`

```elixir
@spec number_input(
  atom(),
  keyword()
) :: t()
```

Creates a `:number_input` field.

# `select`

```elixir
@spec select(
  atom(),
  keyword()
) :: t()
```

Creates a `:select` field.

# `text_input`

```elixir
@spec text_input(
  atom(),
  keyword()
) :: t()
```

Creates a `:text_input` field.

# `textarea`

```elixir
@spec textarea(
  atom(),
  keyword()
) :: t()
```

Creates a `:textarea` field.

# `toggle`

```elixir
@spec toggle(
  atom(),
  keyword()
) :: t()
```

Creates a `:toggle` field.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
