Installation
Install the component
templui add selectboxAdd the JavaScript to your layout
@selectbox.Script() @popover.Script()Call this template in your base layout file (e.g., in the <head> section).
Examples
With Label
Multiple
Multiple Pills
No Search
Disabled
Form
Select a fruit category.
A fruit selection is required.
API Reference
SelectBox
Root container for the select box component.
| Name | Type | Default |
|---|---|---|
Unique identifier for the select container. Auto-generated if not provided. | | - |
Additional CSS classes to apply to the select container. | | - |
Additional HTML attributes to apply to the select container. | | - |
Whether multiple options can be selected. | | |
Trigger
Button that opens the select dropdown when clicked.
| Name | Type | Default |
|---|---|---|
Unique identifier for the trigger element. | | - |
Additional CSS classes to apply to the trigger. | | - |
Additional HTML attributes to apply to the trigger element. | | - |
Name attribute for the hidden input field used in forms. | | - |
Whether the select is disabled and non-interactive. | | |
Whether to display error styling on the select trigger. | | |
Whether multiple selections are allowed. | | |
Whether to show selected items as pills (automatically enables Multiple). | | |
Text template for showing selected count in multiple mode. | | - |
Value
Display area for the selected value(s) or placeholder text.
| Name | Type | Default |
|---|---|---|
Unique identifier for the value element. | | - |
Additional CSS classes to apply to the value display. | | - |
Additional HTML attributes to apply to the value element. | | - |
Placeholder text shown when no option is selected. | | - |
Whether this value display supports multiple selections. | | |
Content
Dropdown container that holds the selectable options.
| Name | Type | Default |
|---|---|---|
Unique identifier for the content element. | | - |
Additional CSS classes to apply to the dropdown content. | | - |
Additional HTML attributes to apply to the content element. | | - |
Whether to hide the search input in the dropdown. | | |
Placeholder text for the search input field. | | - |
Group
Container for grouping related select options together.
| Name | Type | Default |
|---|---|---|
Unique identifier for the group element. | | - |
Additional CSS classes to apply to the group. | | - |
Additional HTML attributes to apply to the group element. | | - |
Label
Label text for a group of select options.
| Name | Type | Default |
|---|---|---|
Unique identifier for the label element. | | - |
Additional CSS classes to apply to the label. | | - |
Additional HTML attributes to apply to the label element. | | - |
Item
Individual selectable option within the dropdown.
| Name | Type | Default |
|---|---|---|
Unique identifier for the item element. | | - |
Additional CSS classes to apply to the item. | | - |
Additional HTML attributes to apply to the item element. | | - |
The value of this option that will be submitted with forms. | | - |
Whether this option is currently selected. | | |
Whether this option is disabled and cannot be selected. | | |