PhoenixDuskmoon.Component.Form.Radio (PhoenixDuskmoon v7.2.1)

View Source

Radio button component for single selection.

Examples

<.dm_form for={@form} phx-submit="save">
  <.dm_radio field={@form[:theme]} value="light" label="Light theme" />
  <.dm_radio field={@form[:theme]} value="dark" label="Dark theme" color="secondary" />
  <.dm_radio field={@form[:theme]} value="auto" label="Auto theme" size="lg" />
</.dm_form>

Attributes

  • field - Phoenix form field
  • value - Radio button value
  • label - Radio button label text
  • size - Radio size: xs, sm, md, lg (default: md)
  • color - Radio color: primary, secondary, accent, info, success, warning, error (default: primary)
  • disabled - Disable the radio button
  • class - Additional CSS classes
  • label_class - Additional CSS classes for label
  • radio_class - Additional CSS classes for radio element

Summary

Functions

dm_radio(assigns)

Attributes

  • id (:any) - Defaults to nil.
  • name (:any)
  • value (:any)
  • field (Phoenix.HTML.FormField) - a form field struct retrieved from the form.
  • checked (:boolean) - Defaults to false.
  • label (:string) - Defaults to nil.
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", or "lg".
  • color (:string) - Defaults to "primary". Must be one of "primary", "secondary", "accent", "info", "success", "warning", or "error".
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • label_class (:string) - Defaults to nil.
  • radio_class (:string) - Defaults to nil.
  • Global attributes are accepted.