View Source SaladUI.Checkbox (SaladUI v1.0.0-beta.3)
Implementation of checkbox component from https://ui.shadcn.com/docs/components/checkbox
Examples:
<.checkbox name="terms" id="terms" />
<div class="flex items-center space-x-2">
<.checkbox id="terms" name="terms" />
<.label for="terms">Accept terms and conditions</.label>
</div>
<.checkbox id="remember_me" name="remember_me" label="Remember me" />
<.form for={@form} as={:user} phx-change="validate">
<.checkbox field={@form[:accept_terms]} label="I accept the terms and conditions" />
</.form>
Summary
Functions
Renders a checkbox input with SaladUI styling.
Functions
Renders a checkbox input with SaladUI styling.
Options
:id
- The id to apply to the checkbox:name
- The name to apply to the input field:value
- The current value of the checkbox:default-value
- The default value of the checkbox, eithertrue
,false
, "true", "false":disabled
- Whether the checkbox is disabled:field
- A Phoenix form field:class
- Additional classes to add to the checkbox
Attributes
name
(:any
) - Defaults tonil
.value
(:any
) - Defaults tonil
.default-value
(:any
) - Defaults tofalse
.field
(Phoenix.HTML.FormField
)class
(:string
) - Defaults tonil
.- Global attributes are accepted.