Select

A form input component that creates a dropdown select element with support for single or multiple selections, option groups, and custom styling.

Basic Select

Creates a standard select element with options.

php
Options
The Select component supports various configuration options.
  • placeholder: Optional placeholder text for the select element
  • multiple: Whether to allow multiple selections
  • selected: The currently selected value
  • options: Array or closure for defining select options
  • divClass: Additional CSS classes for the container div
  • selectClasses: Default Bootstrap classes for the select element
Select Examples
Here are examples of different ways to use the select component.

Select with Placeholder

Creates a select element with placeholder text.

php

Multiple Select

Creates a select element that allows multiple selections.

php

Select with Option Groups

Creates a select element with grouped options.

php

Select with Selected Value

Creates a select element with a pre-selected option.

php

API

The select component extends from HtmlElement so it has all its methods available.

Common alternative names: Dropdown, Select Box, Combo Box, Option List, Choice List

Types: Single Select, Multiple Select, Grouped Select


Principles

User Experience

Select elements provide a compact way to present multiple options while maintaining a clean interface.

Accessibility

Properly structured select elements ensure keyboard navigation and screen reader compatibility.

Flexibility

Select components can be customized with various options and styling to suit different needs.


Anatomy

Select Anatomy
  1. Container
  2. Outer wrapper div

  3. Select Element
  4. The actual select input

  5. Options
  6. Individual option elements

  7. Option Groups
  8. Grouped sets of options

  9. Placeholder
  10. Optional placeholder text

  11. Label
  12. Optional label element


Usage

Use select elements for:

  • Form inputs with predefined options
  • Category selection
  • Status selection
  • Filter controls
  • Configuration settings