Single choice among visible options: radio_group/1, in six forms.
<.radio_group field={@form[:plan]} options={[{"Free", "free"}, {"Pro", "pro"}]} color="primary" />
<.radio_group name="basic" value="primary">
<:radio value="default">Default</:radio>
<:radio value="error" color="error" disabled>Error</:radio>
</.radio_group>
<.radio_group field={@form[:status]} variant="chip" options={[
%{label: "Todos", value: "all", count: 128}, %{label: "Draft", value: "draft"}]} />variant is basic/outline (lu-check radios), card (lu-choice, with control="end"),
chip (lu-rchip, shape="pill" for round ends), segmented (the look of
LedgerUI.Components.Segmented, a button per option over a real radio) and tile (a 52px
square with free content and an aria_label). Every variant keeps a real radio, so the form,
field errors, the arrow keys and phx-change work; the on look follows the radio (hooks
LedgerUI.ChoiceGroup and LedgerUI.Segmented).
Options are {label, value} tuples, plain values, maps with :label, :value,
:description, :count, :icon, :color, :disabled, or :radio slots.
Summary
Functions
A radio, or a group of them: with options (or <:radio> slots) it is radio_group/1; without,
one radio with its label, color and size.
Same as radio_group/1 (same attributes and slots), under the name the design vitrine uses.
Functions
A radio, or a group of them: with options (or <:radio> slots) it is radio_group/1; without,
one radio with its label, color and size.
<.radio name="plan" value="pro" label="Pro" checked />
<.radio field={@form[:plan]} options={[{"Monthly", "m"}, {"Yearly", "y"}]} />Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.field(Phoenix.HTML.FormField) - Defaults tonil.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","outline","card","chip","segmented", or"tile".control(:string) - Defaults to"start". Must be one of"start", or"end".filled(:boolean) - Defaults tofalse.shape(:string) - Defaults to"circle". Must be one of"circle","squircle", or"pill".size(:string) - Defaults to"md". Must be one of"xs","sm","md", or"lg".label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.label_hint(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.wrapper_class(:any) - Defaults tonil.radio_class(:any) - Defaults tonil.class(:any) - Defaults tonil.checked(:boolean) - A lone radio (nooptions, no<:radio>): whether it is the chosen one. Defaults tofalse.- Global attributes are accepted. Supports all globals plus:
["form", "required"].
Slots
radio- Accepts attributes:value(:any)label(:string)color(:string)disabled(:boolean)aria_label(:string)description(:string)count(:any)icon(:string)class(:any)style(:string)checked(:boolean)shape(:string)filled(:boolean)
Same as radio_group/1 (same attributes and slots), under the name the design vitrine uses.
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.field(Phoenix.HTML.FormField) - Defaults tonil.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","outline","card","chip","segmented", or"tile".control(:string) - Defaults to"start". Must be one of"start", or"end".filled(:boolean) - Defaults tofalse.shape(:string) - Defaults to"circle". Must be one of"circle","squircle", or"pill".size(:string) - Defaults to"md". Must be one of"xs","sm","md", or"lg".label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.label_hint(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.wrapper_class(:any) - Defaults tonil.radio_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["form", "required"].
Slots
radio- Accepts attributes:value(:any)label(:string)color(:string)disabled(:boolean)aria_label(:string)description(:string)count(:any)icon(:string)class(:any)style(:string)checked(:boolean)shape(:string)filled(:boolean)
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.field(Phoenix.HTML.FormField) - Defaults tonil.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","outline","card","chip","segmented", or"tile".control(:string) - Defaults to"start". Must be one of"start", or"end".filled(:boolean) - Defaults tofalse.shape(:string) - Defaults to"circle". Must be one of"circle","squircle", or"pill".size(:string) - Defaults to"md". Must be one of"xs","sm","md", or"lg".label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.label_hint(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.wrapper_class(:any) - Defaults tonil.radio_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["form", "required"].
Slots
radio- Accepts attributes:value(:any)label(:string)color(:string)disabled(:boolean)aria_label(:string)description(:string)count(:any)icon(:string)class(:any)style(:string)checked(:boolean)shape(:string)filled(:boolean)