Skip to content
Storybook

Select

Single-select dropdown with label, hint and error. Opens a list of Menu items.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

Team member

This person will be notified.

Usage

  • Use for 6+ options. Fewer? Show Radios.
  • On mobile a native <select> is often better (see example).

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Native select

Same field style on a native element. Best on mobile.

API reference

Class / attributeTypeDescription
px-selectclassHost. Add data-px-select for behaviour.
px-select__triggerclassThe button (combine with px-input).
px-select__valueclassShows the chosen label; data-placeholder for empty.
role="listbox" / role="option"attributeList and items (px-menu / px-menu__item).
px-changeeventFires on the host with detail.value.

Figma properties

Select42 variants · page “Dropdown”Open

Single-select dropdown with label, hint and error. Open shows the option list (Menu items) below the trigger. Use a native <select> on mobile where possible. RTL text: Label/Hint properties driv…

PropertyTypeValues
LabelText“Team member”
HintText“This person will be notified.”
Leading iconBoolean—
SizeVariantSmall Medium Large
StateVariantActive Hover Focused Filled Disabled Error Open
DirectionVariantLTR RTL

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-input-content-placeholdercolor-content-neutral-placeholder#667085
--px-input-content-labelcolor-content-neutral-secondary#475467
--px-input-content-hintcolor-content-neutral-tertiary#667085
--px-input-content-errorcolor-content-danger-default#b42318
--px-input-radiusradius-1212px
--px-input-height-mdspacing-4040px
--px-input-padding-xspacing-1212px
--px-selection-gapspacing-sm8px
--px-input-height-smspacing-3636px
--px-input-height-lgcontrol-height-lg48px
--px-input-gapspacing-88px
--px-input-field-gapspacing-88px
--px-input-width320px320px
--px-menu-backgroundcolor-surface-overlay#ffffff
Show all 30 tokens
TokenAliasLight value
--px-menu-bordercolor-border-neutral-subtle#f2f4f7
--px-menu-item-background-hovercolor-background-neutral-default#f2f4f7
--px-menu-item-background-selectedcolor-background-brand-subtle#eff6ff
--px-menu-item-content-selectedcolor-content-brand-default#2563eb
--px-menu-item-content-destructivecolor-content-danger-default#b42318
--px-menu-item-iconcolor-content-neutral-secondary#475467
--px-menu-sectioncolor-content-neutral-tertiary#667085
--px-menu-radiusradius-1212px
--px-menu-item-radiusradius-88px
--px-menu-paddingspacing-xs4px
--px-menu-item-padding-xspacing-1212px
--px-menu-item-gapspacing-sm8px
--px-menu-item-height-smcontrol-height-sm32px
--px-menu-item-height-mdcontrol-height-md40px
--px-menu-width240px240px
--px-input-focus-halo#2563eb2e#2563eb2e

Accessibility

  • Arrow keys move, Enter selects, Escape closes and returns focus.
  • aria-expanded on the trigger.