View Source Swish.Form (swish v0.0.0)
Link to this section Summary
Functions
Renders a form control component.
Renders a form group component.
Renders a label component.
Renders a message component.
Renders a form component.
Link to this section Functions
Renders a form control component.
examples
Examples
Simple form control
<Swish.Form.control field={f[:name]} type="text" />
<Swish.Form.control field={f[:name]} type="password" />
<Swish.Form.control field={f[:name]} type="textarea" />
<Swish.Form.control field={f[:name]} type="select" />
attributes
Attributes
field(Phoenix.HTML.FormField)type(:string) - Defaults to"text". Global attributes are accepted.
Renders a form group component.
examples
Examples
Simple form group
<Swish.Form.group>
<Swish.Form.control type="text" field={f[:name]} />
</Swish.Form.group>Custom label
<Swish.Form.group label="Enter your first name">
<Swish.Form.control type="text" field={f[:name]} />
</Swish.Form.group>#### Hidden label
<Swish.Form.group label={false}>
<Swish.Form.control type="text" field={f[:name]} />
</Swish.Form.group>
## Attributes
* `id` (`:any`) - Defaults to `nil`.
* `name` (`:any`) - Defaults to `nil`.
* `label` (`:any`) - Defaults to `true`.
* `value` (`:any`) - Defaults to `nil`.
* `field` (`Phoenix.HTML.FormField`)
Global attributes are accepted.
Renders a label component.
examples
Examples
Simple label
<Swish.Form.label field={f[:name]}>
Name
</Swish.Form.label>
attributes
Attributes
label(:string)field(Phoenix.HTML.FormField) Global attributes are accepted.
Renders a message component.
examples
Examples
Simple message
<Swish.Form.message field={f[:name]}>
Name is a required field.
</Swish.Form.message>Custom tag
<Swish.Form.message field={f[:name]} tag="small">
Name is a required field.
</Swish.Form.message>
attributes
Attributes
tag(:any) - Defaults to"p".field(Phoenix.HTML.FormField) Global attributes are accepted.
Renders a form component.
examples
Examples
Simple form control
<Swish.Form.root for={@changeset}>
<Swish.Form.group field={f[:email]} type="text" label="Email">
<Swish.Form.message :let={errors} for={msg <- errors}>
<p><%= msg %></p>
</Swish.Form.message>
</Swish.Form.group>
<Swish.Form.group field={f[:password]} type="password" label="Password">
<Swish.Form.message :let={errors} for={msg <- errors}>
<p><%= msg %></p>
</Swish.Form.message>
</Swish.Form.group>
</Swish.Form.root>
attributes
Attributes
for(:any) (required)as(:any) - Defaults tonil. Global attributes are accepted.
slots
Slots
inner_block(required)