LineaUI.Components.Radio (linea_ui v0.1.1)

Copy Markdown View Source

LineOne's radios, in a group that shares one name: basic or outline, plain or filled box, circle or squircle, in every theme color.

<.radio_group field={@form[:plan]} options={[{"Free", "free"}, {"Pro", "pro"}]} color="primary" />

<.radio_group name="basic" value="primary" class="grid grid-cols-2 gap-6 sm:grid-cols-3">
  <:radio value="default">Default</:radio>
  <:radio value="primary" color="primary">Primary</:radio>
  <:radio value="error" color="error" disabled>Error</:radio>
</.radio_group>

Summary

Functions

Renders a set of radios. Options are {label, value} tuples, plain values, or :radio slots, which may override color, disabled and description one by one.

Functions

radio_group(assigns)

Renders a set of radios. Options are {label, value} tuples, plain values, or :radio slots, which may override color, disabled and description one by one.

Attributes

  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • id (:string) - Defaults to the field's id.
  • name (:string) - Defaults to the field's name.
  • value (:any) - The value of the checked radio.
  • options (:list) - Defaults to [].
  • color (:string) - Defaults to "neutral". Must be one of "neutral", "primary", "secondary", "info", "success", "warning", or "error".
  • variant (:string) - Defaults to "basic". Must be one of "basic", or "outline".
  • filled (:boolean) - Defaults to false.
  • shape (:string) - Defaults to "circle". Must be one of "circle", or "squircle".
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", or "lg".
  • label (:string) - The caption. Defaults to nil.
  • label_class (:any) - Classes of the caption text. Defaults to nil.
  • help (:string) - The small line under the control. Defaults to nil.
  • errors (:list) - Messages to show; field adds its own once the input was used. Defaults to [].
  • disabled (:boolean) - Defaults to false.
  • wrapper_class (:any) - Classes of the outer block (grid placement, spacing). Defaults to nil.
  • radio_class (:any) - Extra classes of every radio input. Defaults to nil.
  • class (:any) - Classes of the container that lays the radios out. Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["form", "required"].

Slots

  • radio - Accepts attributes:
    • value (:any) (required)
    • label (:string)
    • color (:string)
    • disabled (:boolean)
    • description (:string)
    • class (:any)