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, either true, 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 to nil.
  • value (:any) - Defaults to nil.
  • default-value (:any) - Defaults to false.
  • field (Phoenix.HTML.FormField)
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.