PUI.Select.Primitive (pui v1.0.0)

Copy Markdown

Zero-style, hook-wired select parts.

The root accepts search_event and search_debounce for server-backed search. Add search/1 inside the listbox content when the select is searchable; the host LiveView owns querying and re-rendering the options.

Parts

PartDescription
root/1Hook root and remote-search configuration
input/1Hidden form value
trigger/1Accessible select trigger
value/1Selected label or placeholder
content/1Listbox content
search/1Zero-style search input
item/1Select option

Summary

Functions

content(assigns)

Attributes

  • id (:string) (required)
  • trigger_id (:string) (required)
  • Global attributes are accepted.

Slots

  • inner_block (required)

input(assigns)

Attributes

  • id (:string) (required)
  • name (:string) - Defaults to nil.
  • value (:string) - Defaults to nil.
  • Global attributes are accepted.

item(assigns)

Attributes

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

Slots

  • inner_block (required)

root(assigns)

Attributes

  • id (:string) (required)
  • value (:string) - Defaults to nil.
  • search_event (:string) - Defaults to nil.
  • search_debounce (:integer) - Defaults to 300.
  • Global attributes are accepted.

Slots

  • inner_block (required)

search(assigns)

Renders the zero-style search input for a searchable select.

Place this part inside content/1. The surrounding root/1 controls whether typing dispatches a LiveView search event through search_event.

Attributes

  • id (:string) (required)
  • listbox_id (:string) - Defaults to nil.
  • placeholder (:string) - Defaults to "Search item...".
  • Global attributes are accepted.

trigger(assigns)

Attributes

  • id (:string) (required)
  • listbox_id (:string) (required)
  • invalid (:boolean) - Defaults to false.
  • Global attributes are accepted.

Slots

  • inner_block (required)

value(assigns)

Attributes

  • placeholder (:string) - Defaults to "Select an item".
  • Global attributes are accepted.

Slots

  • inner_block