View Source SaladUI.RadioGroup (SaladUI v1.0.0-beta.1)

Implementation of radio group component from https://ui.shadcn.com/docs/components/radio-group

Examples:

<.radio_group name="subscription" default="monthly" on_value_changed={JS.push("plan_changed")}>
  <div class="flex flex-col space-y-2">
    <div class="flex items-center space-x-2">
      <.radio_group_item value="monthly" id="monthly"/>
      <.label for="monthly">Monthly</label>
    </div>
    <div class="flex items-center space-x-2">
      <.radio_group_item value="yearly" id="yearly"/>
      <.label for="yearly">Yearly</label>
    </div>
  </div>
</.radio_group>

Summary

Functions

Radio group component that allows selection of one option from a set.

Individual radio button in a radio group.

Functions

Radio group component that allows selection of one option from a set.

Attributes

  • id (:string) - Defaults to nil.
  • name (:string) - Defaults to nil.
  • value (:any) - The current value of the radio group. Defaults to nil.
  • default-value (:any) - The default value of the radio group. Defaults to nil.
  • on-value-changed (:any) - Handler for value changed event. Defaults to nil.
  • field (Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
Link to this function

radio_group_item(assigns)

View Source

Individual radio button in a radio group.

Attributes

  • id (:string) (required)
  • value (:string) (required)
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.