Repo

Usage

<select class="zui-select">
<option value="">Choose an option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>

With Label

<div class="zui-field">
<label class="zui-label" for="country">Country</label>
<select class="zui-select" id="country">
<option value="">Select a country</option>
<option value="uk">United Kingdom</option>
<option value="us">United States</option>
<option value="de">Germany</option>
<option value="fr">France</option>
</select>
</div>

Disabled

<select class="zui-select" disabled>
<option>Cannot change</option>
</select>

Shape

Use the shape prop to change the corners. It works the same as on Button: default (rounded), hard (square), soft (pill) and squircle.

A squircle is a rounded square with smooth corners. Browsers without corner-shape support show normal rounded corners. To make squircle the default everywhere, see Squircle.

<div class="zui-field">
<label class="zui-label" for="default-select">Default (rounded)</label>
<select class="zui-select" id="default-select"><option>Option one</option><option>Option two</option></select>
</div>
<div class="zui-field">
<label class="zui-label" for="hard-select">Hard</label>
<select class="zui-select zui-select-shape-hard" id="hard-select"><option>Option one</option><option>Option two</option></select>
</div>
<div class="zui-field">
<label class="zui-label" for="soft-select">Soft</label>
<select class="zui-select zui-select-shape-soft" id="soft-select"><option>Option one</option><option>Option two</option></select>
</div>
<div class="zui-field">
<label class="zui-label" for="squircle-select">Squircle</label>
<select class="zui-select zui-select-shape-squircle" id="squircle-select"><option>Option one</option><option>Option two</option></select>
</div>

CSS custom properties

Set these on :root, on a wrapper, or on the element. See Component custom properties.

Property Default Description
--zui-select-radius var(--radius-lg) Border radius
--zui-select-border var(--color-border) Border colour
--zui-select-bg var(--color-background) Background colour
--zui-select-fg var(--color-text) Text colour
--zui-select-padding-block var(--space-3xs) Vertical padding
--zui-select-padding-inline var(--space-xs) Horizontal padding
--zui-select-font-size var(--step-0) Font size
--zui-select-focus-border var(--color-theme) Border colour on focus

Theme

Copy this CSS to your project: