Browse documentation

Select and combobox

Pick one or several options, with optional text filtering.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Single selection

Select presents fixed options. Combobox accepts text and filters choices; use matcher: to customize scoring.

Rendered example
Select, combobox, and multiselect in the component gallery.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::Select.new([["Ruby", :ruby], ["Zig", :zig]], value: :ruby)
Zaniah::UI::Combobox.new(%w[Ruby Zig Rust],
  value: "Ruby", label: "Language")

Multiple selection

MultiSelect shows selected values as removable badges.

Ruby
Zaniah::UI::MultiSelect.new(%w[GPU TUI A11y],
  value: %w[GPU A11y], label: "Targets")

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
Select(items, label:, value:, disabled:); on_changesingle choice
Combobox(items, value:, label:, placeholder:, disabled:, matcher:); on_changeeditable, filtered choices with highlighted matches
MultiSelect(items, value:, label:, disabled:); on_changemultiple selected badges

Accessibility

Comboboxes announce expanded state and options. MultiSelect exposes its option list as a listbox.

ComponentSemantic role
Selectcombobox
Comboboxcombobox
MultiSelectlistbox