Forms v1.0.0

Select

A native select dropdown component with label, hint text, and error states. Supports both form builder mode (with Rails form objects) and standalone usage. Accepts options as arrays or hashes for flexible 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 and :value 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 select
prompt String nil Placeholder prompt text (e.g., "Select an option...")
include_blank Boolean false Whether to include a blank option
required Boolean false Whether the field is required
disabled Boolean false Whether the field is disabled
size Symbol :md Select size: :sm, :md, or :lg
error String nil Manual error message (auto-detected from form object if not provided)
class String "" Additional CSS classes for the select

Changelog v1.0.0

- Initial release with form builder and standalone modes
- Three size options: sm, md (default), lg
- Flexible options format (strings, arrays, hashes)
- 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