Canvas Design System
Main Site Tokens

Select

Dropdown select fields for form options. Supports labels, placeholders, sizes, and validation states.

When to Use

Use Select when: The user must pick one option from a predefined list of 4+ items. Good for categories, filters, and settings where the options are known ahead of time.
Don't use when: There are fewer than 4 options — use radio buttons or Tabs instead. For free-form input with suggestions, use an autocomplete input.

Basic Select

expand_more
<?= ws_select('category', [
    'ideation' => 'Ideation',
    'strategy' => 'Strategy',
    'team' => 'Team Building',
], ['label' => 'Category', 'placeholder' => 'Select...', 'required' => true]) ?>

Sizes

expand_more
expand_more
expand_more

With Pre-selected Value

expand_more
<?= ws_select('workshop_type', [
    'design_sprint' => 'Design Sprint',
    'retrospective' => 'Retrospective',
], ['label' => 'Workshop Type', 'value' => 'retrospective']) ?>

Validation States

expand_more
Choose the option that best fits your needs
expand_more
Please select an option
expand_more
<?= ws_select('field', $opts, ['error' => 'Please select an option']) ?>
<?= ws_select('field', $opts, ['helper' => 'Helpful description']) ?>
<?= ws_select('field', $opts, ['disabled' => true]) ?>

Parameters

ParameterTypeDefaultDescription
$namestringField name attribute (required)
$selectOptionsarrayKey-value pairs of value => label
labelstringnullField label text
valuestring''Pre-selected value
placeholderstringnullPlaceholder option text
requiredboolfalseMark as required
disabledboolfalseDisabled state
errorstringnullError message (shows error styling)
helperstringnullHelper text below the field
sizestringmdsm | md | lg
idstring$nameElement ID
classstring''Additional CSS classes
attrsarray[]Extra HTML attributes

Anatomy

.ws-field — Outer field wrapper
.ws-field__label — Label text
.ws-select-wrap — Select + arrow container
.ws-select — Native <select> element
.ws-select__arrow — Dropdown chevron icon
.ws-field__error / .ws-field__helper — Validation or helper text

CSS Classes

ClassPurpose
.ws-selectBase select styles
.ws-select--sm / --md / --lgSize modifiers
.ws-select-wrapWrapper for select + arrow
.ws-fieldField wrapper (shared with Input)
.ws-field--errorError state on field wrapper

Files

FilePurpose
includes/components/helpers.phpws_select() helper function
includes/components/select.phpSelect template
includes/components/components.cssSelect CSS (.ws-select rules)