Lotus.Web.SelectComponent (Lotus Web v0.14.5)

View Source

A Tailwind-styled, accessible single-select dropdown.

Props:

  • id - required, base id for button & listbox
  • name - required, posted param name
  • options - required, list of {label, value}
  • value - current value (string/integer)
  • label - optional label text
  • prompt - optional prompt text when no value is selected
  • disabled - boolean
  • errors - list of error strings (shown under the field)

Emits:

  • updates the hidden <input name> so phx-change on the surrounding form receives the change as usual.

Summary

Functions

handle_event(binary, arg2, socket)

Callback implementation for Phoenix.LiveComponent.handle_event/3.

render(assigns)

Attributes

  • id (:string) (required)
  • name (:string) (required)
  • options (:list) (required)
  • value (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • floating_label (:boolean) - Defaults to false.
  • prompt (:string) - Defaults to nil.
  • disabled (:boolean) - Defaults to false.
  • errors (:list) - Defaults to [].
  • show_icons (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.

update(assigns, socket)

Callback implementation for Phoenix.LiveComponent.update/2.