View Source SaladUI.Select (SaladUI v0.14.0)

Implement of select components from https://ui.shadcn.com/docs/components/select

Examples:

<form>
   <.select default="banana" id="fruit-select">
      <.select_trigger class="w-[180px]">
        <.select_value placeholder=".select a fruit"/>
      </.select_trigger>
      <.select_content>
        <.select_group>
          <.select_label>Fruits</.select_label>
          <.select_item name="fruit" value="apple">Apple</.select_item>
          <.select_item name="fruit" value="banana">Banana</.select_item>
          <.select_item name="fruit" value="blueberry">Blueberry</.select_item>
          <.select_separator />
          <.select_item  name="fruit" disabled value="grapes">Grapes</.select_item>
          <.select_item  name="fruit" value="pineapple">Pineapple</.select_item>
        </.select_group>
  </.select_content>
    </.select>

  <.button type="submit">Submit</.button>
</form>

Summary

Functions

Ready to use select component with all required parts.

Attributes

  • builder (:map) (required) - The builder of the select component.
  • class (:string) - Defaults to nil.
  • side (:string) - Defaults to "bottom".
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • builder (:map) (required) - The builder of the select component.
  • value (:string) (required)
  • label (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • builder (:map) (required) - The builder of the select component.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Functions

Ready to use select component with all required parts.

Attributes

  • id (:string) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • value (:any) - The value of the select. Defaults to nil.
  • default-value (:any) - The default value of the select. Defaults to nil.
  • field (Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].
  • label (:string) - The display label of the select value. If not provided, the value will be used. Defaults to nil.
  • placeholder (:string) - The placeholder text when no value is selected. Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • builder (:map) (required) - The builder of the select component.
  • class (:string) - Defaults to nil.
  • side (:string) - Defaults to "bottom".
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • builder (:map) (required) - The builder of the select component.
  • value (:string) (required)
  • label (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

Attributes

  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)
Link to this function

select_separator(assigns)

View Source

Attributes

  • builder (:map) (required) - The builder of the select component.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.