Forms.input
Server-rendered
Renders an input with shadcn classes.
With FormField
<.input field={@form[:email]} />With label
<.input field={@form[:email]} label="Email" />With explicit errors
<.input field={@form[:email]} label="Email" errors={["can't be blank"]} />Inside field composition
<.field>
<:label><.label for={@form[:email].id}>Email</.label></:label>
<.input field={@form[:email]} />
<:description>We'll send alerts here.</:description>
</.field>
Text input
<.input id="email" type="email" placeholder="name@example.com" />
With value
<.input id="username" name="username" value="levi" />
Attributes
| Name | Type | Default | Values | Global Includes |
|---|---|---|---|---|
class
|
:string |
— | — | — |
errors
|
:list |
— | — | — |
field
|
{:struct, Phoenix.HTML.FormField} |
— | — | — |
id
|
:string |
— | — | — |
label
|
:string |
— | — | — |
name
|
:string |
— | — | — |
placeholder
|
:string |
— | — | — |
rest
|
:global |
— | — |
accept
,
autocomplete
,
disabled
,
max
,
maxlength
,
min
,
minlength
,
pattern
,
readonly
,
required
,
step
|
type
|
:string |
"text"
|
— | — |
value
|
:string |
— | — | — |
Slots
No slots declared.