defmodule PyrauiWeb.DocsLive.MultiSelectDocs do use PyrauiWeb, :html def render(assigns) do ~H"""
Multi-select component with chips/tags display for selecting multiple items from a list.
<.multi_select field={@form[:tags]} options={["Option 1", "Option 2", "Option 3"]} />
<.multi_select field={@form[:categories]} options={categories} label="Categories" />
<.multi_select
field={@form[:tags]}
options={[
{"Frontend", "frontend"},
{"Backend", "backend"},
{"DevOps", "devops"}
]}
/>
The multi-select component requires a JavaScript hook (MultiSelectHook) for dropdown toggle functionality.
Selected values are submitted as an array in the form params.
| Prop | Type | Default | Description |
|---|---|---|---|
| field | Phoenix.HTML.FormField | - | Form field struct |
| options | list | - | List of options (strings or label-value tuples) |
| placeholder | string | "Select options..." | Placeholder text when no items selected |