Forms v1.0.0

Combobox

A searchable select dropdown component with keyboard navigation. Supports both form builder mode (with Rails form objects) and standalone usage. Features include filtering options by typing, keyboard navigation, and custom option rendering.

Preview & Code

Options

Name Type Default Description
form FormBuilder nil Rails form builder object (for form builder mode)
attribute Symbol nil Model attribute name (for form builder mode)
name String nil Input name attribute (for standalone mode)
options * Array required Array of options - can be strings, [label, value] pairs, or hashes with :label, :value, and optional :description keys
selected String nil Currently selected value (for standalone mode, auto-detected in form mode)
label String nil Label text (auto-generated from attribute if not provided)
hint String nil Help text displayed below the combobox
placeholder String "Search..." Placeholder text for the search input
empty_message String "No results found" Message shown when no options match the search
required Boolean false Whether a selection is required
disabled Boolean false Whether the combobox is disabled
error String nil Manual error message (auto-detected from form object if not provided)
class String "" Additional CSS classes for the container

Changelog v1.0.0

- Initial release with form builder and standalone modes
- Real-time search filtering
- Keyboard navigation (arrow keys, enter, escape)
- Support for option descriptions
- Automatic error detection from Rails form objects
- Dark mode support

Get Full Access

Unlock the source code for this component and all others. One-time payment for lifetime access.

Get Access Now