27.0.0-preview.2 (most recent)27.0.0-preview.1BlazorReactWeb

Select

A select picks exactly one option from a long list and keeps the list closed until you open it. The variant sets how much weight the field carries on a form, from a filled panel to plain text. Open the selects below, then press an arrow key or type a letter to move through their options.

Iceland Japan Kenya Peru Light Medium Dark Tomato Pesto Garlic cream 6 to 7 pm 7 to 8 pm 8 to 9 pm Thin Sourdough Deep pan Stuffed Basil Olives Chili oil Small Medium Large Sparkling water Lemonade Cola Dine in Patio Counter Tiramisu Gelato Soup Salad Espresso Latte

Reference docs⁠

OverviewExamplesAPIStylingAccessibility

Choosing a selection control⁠

Four components capture a choice in a form. Each suits a different job:

  • Checkbox: one or more options picked from a short list, or a single yes to confirm, such as "I agree to the terms".
  • Switch: a setting that takes effect the moment it is flipped, such as Wi-Fi or dark mode.
  • Radio buttons: exactly one option from a short list shown in full, such as delivery speed.
  • Select: exactly one option from a longer list kept closed until opened, such as country.

Two jobs belong elsewhere. A choice made by clicking a compact tag, such as filtering results, is a filter chip, and a two-state setting in a toolbar is a toggle button.

Choosing a variant⁠

Three variants differ in how much frame surrounds the chosen text, from most to least:

  • Filled: a field that needs a distinct ground, such as a settings page or a checkout form.
  • Outlined: a form with many fields in a row, where an outline separates them without adding weight.
  • Text: a field inside a toolbar or a table row, such as a sort order, where a container would add noise.

Built in⁠

  • A menu that opens from the field and closes on a choice, animated by animation.
  • Typeahead: typing a letter on the closed field selects the matching option, and typeahead-delay sets how long the typed letters count together.
  • Form participation, so a form collects the choice without glue code.
  • Required and error states: required adds an asterisk to the label, and error-text replaces supporting-text while error is set.
  • A badge on the field with badge-value, concealed with badge-concealed.
  • A leading icon in the leading-icon slot that the field makes room for.
  • Choosing one option clears selected on the others, and defaultSelected remembers the markup's choice, so a form reset restores it.
  • display-text sets the short text the field shows for an option, while its row keeps the full label.
  • An option row shows an icon at either end, set by name or by slot, and can carry an overline, supporting text, and trailing supporting text.

Hidden content renders when first shown⁠

A select keeps its option list hidden until the field opens it. Each opening starts like the first: on the chosen option, or on the first option when none is chosen. Your options and the chosen value are untouched. Wait for updateComplete and the hidden content has rendered, so your code can reach it at once. See Hidden content renders when first shown.

Using selects well⁠

  • Give every select a label that names the choice, such as "Country", and set aria-label to the same words.
  • Choose a select when the reader picks one option from a list too long to show in full, and radio buttons when every option should stay visible.
  • Choose checkboxes when the reader may pick more than one option: a select holds a single selection.
  • Choose a switch for a setting with two states; a select suits three or more options.
  • Say how to choose in supporting-text, and say how to fix a problem in error-text.
  • Keep option labels short and distinct, and write the full name in the row with a short code in display-text, as with "United States of America" and "US".
  • Give every option an icon or none, and keep supporting text for a second line of information, never for instructions.
  • Keep a disabled option visible, and explain why in the select's own supporting text, since the option cannot take focus.

Theming fields⁠

Set one design token and every field of that variant follows it: text fields, text areas, selects, and the email, number, password, search, and telephone fields alike.

  • --ct-field-filled-* themes filled fields, --ct-field-outlined-* outlined fields, and --ct-field-text-* fields with no container.
  • A token set on the page, or on any element that contains fields, reaches every field of its variant inside it.
  • To restyle selects only, set the token on the element in your own CSS:
cw-select {
  --ct-field-outlined-corner-shape: square;
}
content_copy

The Styling tab lists every token and its default.

These rules follow Material 3 Expressive's guidance for menus, on material.io.

Variants⁠

variant picks filled, outlined, or text. Omit it and the select takes the variant from your style configuration, which is filled unless you have changed it. The Overview says when to choose each.

Labels and errors⁠

label floats above the chosen text, and supporting-text sits below the field. required adds an asterisk to the label, and no-asterisk removes it. While error is set, error-text replaces the supporting text, and an error icon replaces the arrow. error needs error-text: the color and the icon tell the reader something is wrong, and only your text says what and how to fix it. A text variant draws no floating label: label there is only the accessible name.

Icons⁠

Put an icon in the leading-icon slot to show it before the chosen text, or in trailing-icon to replace the arrow. The select sets has-leading-icon itself when it sees a leading icon, so you set it only when rendering on a server.

Badges⁠

badge-value puts text in a badge on the field. badge-dot shows a dot instead, and badge-concealed hides the badge without clearing its value, so clearing it shows the same badge again.

Put cw-select-option elements in the default slot, or give expressContent an array of strings or option objects. When both are present, the slot wins and the select logs a warning. clamp-menu-width keeps the menu no wider than the field, and typeahead-delay sets how long typed letters count as one search. display-text is for server rendering only.

A string in expressContent is an option whose value is the same string. In Blazor, the list is an IEnumerable<ExpressSelectElement>: a string converts to an option, and an option object is new ExpressSelectOption { Content = "Kyoto", Value = "kyoto" }, where Content and Value are both required.

Row content⁠

An option's label is its default slot. The overline, supporting-text, and trailing-supporting-text slots add small text above, below, and at the end of the row. The start and end slots take other leading and trailing content.

Option icons⁠

leading-icon-name and trailing-icon-name name a Material Symbols icon for each end of the row. A start or end slot takes precedence over its icon name. In a right-to-left layout, flip-leading-icon-in-rtl and flip-trailing-icon-in-rtl mirror a directional icon. This demo sets the layout right to left, and the switch flips the arrows on the first option.

Display text⁠

display-text sets what the field shows once the option is chosen. Without it, the field shows the option's typeahead text, then its default slot text, then its supporting text. Use it when the row needs a long label and the field should stay short. It changes the field only, so the option's accessible name stays the same.

Preselecting⁠

selected marks an option as chosen. Writing it in markup preselects the option, and setting it from code chooses the option and clears the others. The switch here chooses the second option from code.

Option values⁠

The select submits the chosen option's value, which is an empty string until you set it. Listen for change and input on the select; the option fires neither. In change, detail.value holds the chosen value, or null when nothing is chosen.

In Blazor, CbSelect and CbSelectOption are generic: TItem is the type of the value. Write TItem="string" on CbSelect, and write each option's value as a C# string, Value="@("light")". A bare Value="light" is read as a C# name and does not compile.

Disabled options⁠

disabled dims a row and makes it non-selectable. The row stays visible and drops out of the Tab order, so keyboard focus never reaches it. The switch here marks the first option as sold out.

Forms⁠

The select is a form control: it submits value under name, and a form reset restores its default. value holds the chosen option's value, and setting value from code selects that option without firing input or change. A user's choice fires input, then change.

In Blazor, bind the value with @bind-Value to a string field, and keep TItem="string" and the quoted option values.

Autofill⁠

Set autocomplete to an autofill token, such as bday-month or cc-exp-month, on a select that asks for the reader's own details. The browser can then fill the choice, and it reaches value as if the reader had chosen it. Leave it unset, and the browser fills nothing. Autofill works for a select of up to 300 options; with more, the browser cannot fill it.

Disabled⁠

disabled stops the field from opening. A select inside a disabled <fieldset> reads as disabled too, without the attribute.

Animation⁠

animation sets how the menu appears: none, fade, faded-slide, or expand. Choose one in the first select and open the second to see it.

In React, a state that holds an animation needs the enum's type, or TypeScript rejects the plain string: React.useState<PopoverAnimationType>('fade'), with PopoverAnimationType imported from the React package. In Blazor, the field is a PopoverAnimation, such as PopoverAnimation.Fade.

Density⁠

density shortens the field in four steps below the standard height. Omit it and the select takes its density from your style configuration, which is standard unless you have changed it. A text variant ignores it, and a filled select at density 2 or higher hides its floating label, so give it aria-label.

The steps are the strings "0" to "4". In React, write density="2" or density={Density.Dense2}, and type a state that holds one as DensityType; a number does not compile. In Blazor, write Density="@Density.Dense2".

Select Select option

Properties⁠

PropertyAttributeTypeDescription
animationanimationnone, fade, faded-slide, expandPopoverAnimationPopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
autocompleteautocompletestringWhat the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use cw-select for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
badgeConcealedbadge-concealedbooleandefault falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
badgeDotbadge-dotbooleandefault falseShows the badge as a small dot with no text, whether or not badgeValue is set. See Badges.
badgeValuebadge-valuestringThe badge's text. While it is empty and badgeDot is not set, no badge renders. Ignored if badgeDot is set. See Badges.
clampMenuWidthclamp-menu-widthbooleandefault falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
compareWith(a: TItem, b: TItem) => booleanDecides whether an option's value and the select's value name the same option. When set, it is the only test. Set it from code; it has no attribute.
densitydensity0, 1, 2, 3, 4DensityDensity.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
disableddisabledbooleanWhether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
displayTextdisplay-textstringThe text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
errorerrorbooleandefault falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while error is set the select shows errorText only: it writes no message for error, and does not show the browser's validation message in its place. Set errorText to say what is wrong and how to fix it. With error set, no errorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
errorTexterror-textstringThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
expressContentExpressSelectElement[]The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
formread-onlyHTMLFormElementThe form the component belongs to, or null when it has none.
hasLeadingIconhas-leading-iconbooleandefault falseWhether the select has a leading icon. It follows the leading-icon slot, so set it only for server-side rendering. See Icons.
labellabelstringThe floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
labelsread-onlyNodeListThe <label> elements associated with the element.
namenamestringThe name the element's value is submitted under with its form. See Forms.
noAsteriskno-asteriskbooleandefault falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
optionsread-onlySelectOption[]The select's options.
requiredrequiredbooleandefault falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
selectedOptionread-onlySelectOptionThe chosen option, or null when none is chosen.
supportingTextsupporting-textstringConveys additional information below the select, such as how it should be used. See Labels and errors.
typeaheadDelaytypeahead-delaynumberdefault DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
validationMessageread-onlystringThe message describing why the element is invalid, or an empty string when it is valid.
validityread-onlyValidityStateThe element's ValidityState.
valuevalueTItemThe currently selected option's value, of any type. An option matches it by compareWith, else by valueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and displayText rather than setting value. See Option values, Forms, Autofill.
valueKeyvalue-keystringThe field that identifies an object value: an option whose object holds the same value in this field as the select's object is its option, and the form submits this field.
variantvariantfilled, outlined, textFieldVariantFieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.
willValidateread-onlybooleanWhether the element takes part in constraint validation. False while it is disabled or read-only.

Slots⁠

SlotDescription
(default)The cw-select-option elements to choose from.
containerCustom background content.
leading-iconThe leading icon, intended for a cw-icon or equivalent.
trailing-iconThe trailing icon, intended for a cw-icon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Events⁠

EventTypeDetailDescription
changeSelectionChangeEventSelectionChangeEventDetail<TItem>Fired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting value from code does not fire it, nor does such a value's option arriving later. It bubbles.
inputEvent—Fired on the select after a user chooses an option, before change. Setting value from code does not fire it. It bubbles and is composed.
beforetoggleToggleEvent—Fired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
toggleToggleEvent—Fired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Methods⁠

MethodReturnsDescription
checkValidity()booleanChecks the element's validity and returns true if it is valid. If not, it dispatches an invalid event; nothing changes on screen.
reportValidity()booleanChecks the element's validity and returns true if it is valid. If not, it dispatches a cancelable invalid event and, unless a listener cancels it, shows validationMessage as the field's error text and focuses the field.
reset()voidReset the select to its default value.
selectIndex(index: number)voidChooses the option at the given index, which changes the select's value.
setCustomValidity(error: string)voidSets a custom validation message, which makes the element invalid. An empty string clears it.

Props⁠

PropTypeDescription
animationPopoverAnimationTypePopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
autocompletestringWhat the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use CrSelect for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
badgeConcealedbooleandefault falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
badgeDotbooleandefault falseShows the badge as a small dot with no text, whether or not badgeValue is set. See Badges.
badgeValuestringThe badge's text. While it is empty and badgeDot is not set, no badge renders. Ignored if badgeDot is set. See Badges.
clampMenuWidthbooleandefault falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
compareWith(a: TItem, b: TItem) => booleanDecides whether an option's value and the select's value name the same option. When set, it is the only test. Set it from code; it has no attribute.
defaultValueTItemThe starting value, applied once when the element mounts and ignored afterwards: the uncontrolled form. Ignored while value is set.
densityDensityTypeDensity.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
disabledbooleanWhether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
displayTextstringThe text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
errorbooleandefault falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while error is set the select shows errorText only: it writes no message for error, and does not show the browser's validation message in its place. Set errorText to say what is wrong and how to fix it. With error set, no errorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
errorTextstringThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
expressContentExpressSelectElement[]The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
formread-only (ref)HTMLFormElementThe form the component belongs to, or null when it has none.
hasLeadingIconbooleandefault falseWhether the select has a leading icon. It follows the slot="leading-icon" child, so set it only for server-side rendering. See Icons.
labelstringThe floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
labelsread-only (ref)NodeListThe <label> elements associated with the element.
namestringThe name the element's value is submitted under with its form. See Forms.
noAsteriskbooleandefault falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
onValueChange(value: TItem | null, event: Event) => voidFires with the live value value and the event, whenever the underlying element dispatches change for itself (a bubbled event from a nested component is ignored) — controlled-component ergonomics alongside the plain value prop above.
optionsread-only (ref)SelectOption[]The select's options.
requiredbooleandefault falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
selectedOptionread-only (ref)SelectOptionThe chosen option, or null when none is chosen.
supportingTextstringConveys additional information below the select, such as how it should be used. See Labels and errors.
typeaheadDelaynumberdefault DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
validationMessageread-only (ref)stringThe message describing why the element is invalid, or an empty string when it is valid.
validityread-only (ref)ValidityStateThe element's ValidityState.
valueTItemThe currently selected option's value, of any type. An option matches it by compareWith, else by valueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and displayText rather than setting value. See Option values, Forms, Autofill.
valueKeystringThe field that identifies an object value: an option whose object holds the same value in this field as the select's object is its option, and the form submits this field.
variantFieldVariantTypeFieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.
willValidateread-only (ref)booleanWhether the element takes part in constraint validation. False while it is disabled or read-only.

Children⁠

ChildDescription
childrenThe CrSelectOption elements to choose from.
a child with slot="container"Custom background content.
a child with slot="leading-icon"The leading icon, intended for a CrIcon or equivalent.
a child with slot="trailing-icon"The trailing icon, intended for a CrIcon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Events⁠

PropArgumentDescription
onChangeSelectionChangeEvent<TItem>Fired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting value from code does not fire it, nor does such a value's option arriving later. It bubbles. Its detail carries value and values.
onInputReact.ChangeEvent<CrSelectElement<TItem>>Fired on the select after a user chooses an option, before change. Setting value from code does not fire it. It bubbles and is composed.
onBeforeToggleToggleEventFired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
onToggleToggleEventFired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Methods⁠

Call these on the element the ref holds.

MethodReturnsDescription
checkValidity()booleanChecks the element's validity and returns true if it is valid. If not, it dispatches an invalid event; nothing changes on screen.
reportValidity()booleanChecks the element's validity and returns true if it is valid. If not, it dispatches a cancelable invalid event and, unless a listener cancels it, shows validationMessage as the field's error text and focuses the field.
reset()voidReset the select to its default value.
selectIndex(index: number)voidChooses the option at the given index, which changes the select's value.
setCustomValidity(error: string)voidSets a custom validation message, which makes the element invalid. An empty string clears it.

Parameters⁠

ParameterTypeDescription
AnimationPopoverAnimation?PopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
Autocompletestring?What the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's Value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use CbSelect for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
BadgeConcealedbool?default falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
BadgeDotbool?default falseShows the badge as a small dot with no text, whether or not BadgeValue is set. See Badges.
BadgeValuestring?The badge's text. While it is empty and BadgeDot is not set, no badge renders. Ignored if BadgeDot is set. See Badges.
ClampMenuWidthbool?default falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
DensityDensity?Density.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
Disabledbool?Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
DisplayTextstring?The text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
Errorbool?default falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while Error is set the select shows ErrorText only: it writes no message for Error, and does not show the browser's validation message in its place. Set ErrorText to say what is wrong and how to fix it. With Error set, no ErrorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
ErrorTextstring?The error message that replaces supporting text when Error is true. If ErrorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; Error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
ExpressContentinteractive rendering onlyIEnumerable<ExpressSelectElement>?The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
HasLeadingIconbool?default falseWhether the select has a leading icon. It follows the LeadingIcon render fragment, so set it only for server-side rendering. See Icons.
Labelstring?The floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
Namestring?The name the element's value is submitted under with its form. See Forms.
NoAsteriskbool?default falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
Requiredbool?default falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
SupportingTextstring?Conveys additional information below the select, such as how it should be used. See Labels and errors.
TypeaheadDelayint?default DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
ValueTItemThe currently selected option's value, of any type. An option matches it by CompareWith, else by ValueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and DisplayText rather than setting Value. See Option values, Forms, Autofill.
ValueExpressionExpression<Func<TItem>>?Gets or sets an expression that identifies the bound value.
VariantFieldVariant?FieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.

Render fragments⁠

Once you write LeadingIcon or any other fragment as a child element, the main content must go in an explicit <ChildContent> too; markup beside <LeadingIcon> is a compile error; an @if or @foreach around a fragment is the same error: put the condition inside the fragment. Here ChildContent is: The CbSelectOption elements to choose from.

<CbSelect>
    <LeadingIcon><CbIcon>favorite</CbIcon></LeadingIcon>
    <ChildContent>Main content</ChildContent>
</CbSelect>
content_copy
ParameterTypeDescription
ChildContentRenderFragment?The CbSelectOption elements to choose from.
ContainerRenderFragment?Custom background content.
LeadingIconRenderFragment?The leading icon, intended for a CbIcon or equivalent.
TrailingIconRenderFragment?The trailing icon, intended for a CbIcon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Event callbacks⁠

ParameterTypeDescription
OnChangeEventCallback<SelectionChangeEventArgs<TItem>>Fired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting Value from code does not fire it, nor does such a value's option arriving later. It bubbles. The handler's argument has Value and Values: read args.Value; there is no Detail.
OnInputEventCallback<ChangeEventArgs>Fired on the select after a user chooses an option, before change. Setting Value from code does not fire it. It bubbles and is composed.
OnBeforeToggleEventCallback<ToggleEventArgs>Fired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
OnToggleEventCallback<ToggleEventArgs>Fired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Inputs⁠

InputTypeDescription
animationPopoverAnimationTypePopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
autocompletestringWhat the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use CaSelect for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
badgeConcealedbooleandefault falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
badgeDotbooleandefault falseShows the badge as a small dot with no text, whether or not badgeValue is set. See Badges.
badgeValuestringThe badge's text. While it is empty and badgeDot is not set, no badge renders. Ignored if badgeDot is set. See Badges.
clampMenuWidthbooleandefault falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
compareWith(a: TItem, b: TItem) => booleanDecides whether an option's value and the select's value name the same option. When set, it is the only test. Set it from code; it has no attribute.
densityDensityTypeDensity.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
disabledbooleanWhether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
displayTextstringThe text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
errorbooleandefault falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while error is set the select shows errorText only: it writes no message for error, and does not show the browser's validation message in its place. Set errorText to say what is wrong and how to fix it. With error set, no errorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
errorTextstringThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
expressContentExpressSelectElement[]The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
hasLeadingIconbooleandefault falseWhether the select has a leading icon. It follows the leading-icon slot, so set it only for server-side rendering. See Icons.
labelstringThe floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
namestringThe name the element's value is submitted under with its form. See Forms.
noAsteriskbooleandefault falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
requiredbooleandefault falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
supportingTextstringConveys additional information below the select, such as how it should be used. See Labels and errors.
typeaheadDelaynumberdefault DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
valueTItemThe currently selected option's value, of any type. An option matches it by compareWith, else by valueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and displayText rather than setting value. See Option values, Forms, Autofill.
valueKeystringThe field that identifies an object value: an option whose object holds the same value in this field as the select's object is its option, and the form submits this field.
variantFieldVariantTypeFieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.

Content projection⁠

ContentDescription
content with no slotThe CaSelectOption elements to choose from.
an element with slot="container"Custom background content.
an element with slot="leading-icon"The leading icon, intended for a CaIcon or equivalent.
an element with slot="trailing-icon"The trailing icon, intended for a CaIcon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Outputs⁠

OutputEventDescription
cwChangeSelectionChangeEventFired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting value from code does not fire it, nor does such a value's option arriving later. It bubbles. Its detail carries value and values.
cwInputEventFired on the select after a user chooses an option, before change. Setting value from code does not fire it. It bubbles and is composed.
cwBeforeToggleToggleEventFired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
cwToggleToggleEventFired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Props⁠

PropTypeDescription
animationPopoverAnimationTypePopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
autocompletestringWhat the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use CvSelect for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
badgeConcealedbooleandefault falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
badgeDotbooleandefault falseShows the badge as a small dot with no text, whether or not badgeValue is set. See Badges.
badgeValuestringThe badge's text. While it is empty and badgeDot is not set, no badge renders. Ignored if badgeDot is set. See Badges.
clampMenuWidthbooleandefault falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
compareWith(a: TItem, b: TItem) => booleanDecides whether an option's value and the select's value name the same option. When set, it is the only test. Set it from code; it has no attribute.
densityDensityTypeDensity.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
disabledbooleanWhether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
displayTextstringThe text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
errorbooleandefault falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while error is set the select shows errorText only: it writes no message for error, and does not show the browser's validation message in its place. Set errorText to say what is wrong and how to fix it. With error set, no errorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
errorTextstringThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
expressContentExpressSelectElement[]The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
hasLeadingIconbooleandefault falseWhether the select has a leading icon. It follows the leading-icon slot, so set it only for server-side rendering. See Icons.
labelstringThe floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
namestringThe name the element's value is submitted under with its form. See Forms.
noAsteriskbooleandefault falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
requiredbooleandefault falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
supportingTextstringConveys additional information below the select, such as how it should be used. See Labels and errors.
typeaheadDelaynumberdefault DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
valueTItemThe currently selected option's value, of any type. An option matches it by compareWith, else by valueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and displayText rather than setting value. See Option values, Forms, Autofill.
valueKeystringThe field that identifies an object value: an option whose object holds the same value in this field as the select's object is its option, and the form submits this field.
variantFieldVariantTypeFieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.

Slots⁠

SlotDescription
defaultThe CvSelectOption elements to choose from.
containerCustom background content.
leading-iconThe leading icon, intended for a CvIcon or equivalent.
trailing-iconThe trailing icon, intended for a CvIcon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Events⁠

EventTypeDescription
changeSelectionChangeEventFired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting value from code does not fire it, nor does such a value's option arriving later. It bubbles. Its detail carries value and values.
inputEventFired on the select after a user chooses an option, before change. Setting value from code does not fire it. It bubbles and is composed.
beforeToggleToggleEventFired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
toggleToggleEventFired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Props⁠

PropTypeDescription
animationPopoverAnimationTypePopoverAnimation.None, .Fade, .FadedSlide, .ExpandThe menu's open and close animation. Unset, it follows the style configuration, which defaults to faded-slide. See Animation.
autocompletestringWhat the browser may fill this select with, as an autofill token such as country-name, bday-month or cc-exp-month. Set it on a select that collects the user's own details, so a browser and an assistive tool know the purpose of the input (WCAG 1.3.5, Identify Input Purpose). Left empty, the browser fills nothing.The select renders a hidden native <select> that carries the token and mirrors the options; the browser fills that one, and the choice reaches this select's value. It mirrors up to 300 options. Beyond that it renders nothing and the browser cannot fill the select.A personal-data field with a long list of options, such as a country, is better served by a field the user can type into. Use CsSelect for choices that are not personal data.See MDN: autocomplete attribute. See Autofill.
badgeConcealedbooleandefault falseHides the badge while keeping its value and dot setting, so clearing this property shows the same badge again. See Badges.
badgeDotbooleandefault falseShows the badge as a small dot with no text, whether or not badgeValue is set. See Badges.
badgeValuestringThe badge's text. While it is empty and badgeDot is not set, no badge renders. Ignored if badgeDot is set. See Badges.
clampMenuWidthbooleandefault falseLimits the menu's width to the select's width. Without it, the menu is at least that wide and can grow wider. See Menu content.
compareWith(a: TItem, b: TItem) => booleanDecides whether an option's value and the select's value name the same option. When set, it is the only test. Set it from code; it has no attribute.
densityDensityTypeDensity.Standard, .Dense1, .Dense2, .Dense3, .Dense4default Density.Standard, from the style configurationThe field's density level. Unset, the style configuration's default field density applies, else Standard.Ignored for Text variants. See Density.
disabledbooleanWhether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled options, Disabled.
displayTextstringThe text shown in the field. It follows the chosen option, so set it only for server-side rendering. See Menu content, Display text.
errorbooleandefault falseGets or sets whether or not the select is in a visually invalid state. The error state turns the select's colors to the error color, shows an error icon in place of the arrow and marks the select invalid for assistive technology.The color and the icon say that something is wrong, not what or how to fix it, and while error is set the select shows errorText only: it writes no message for error, and does not show the browser's validation message in its place. Set errorText to say what is wrong and how to fix it. With error set, no errorText and no validation message from the browser, the select logs a console warning.This error state overrides the error state controlled by reportValidity(). See Labels and errors.
errorTextstringThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. Write a message that says what is wrong and how to fix it; error needs it, because the error color and icon alone tell some people nothing.This error message overrides the error message displayed by reportValidity(). See Labels and errors.
expressContentExpressSelectElement[]The options to show, as an array of ExpressSelectOption or string elements. Slotted options take precedence, and the select logs a warning when both are set. See Menu content.
hasLeadingIconbooleandefault falseWhether the select has a leading icon. It follows the leadingIconSnippet snippet, so set it only for server-side rendering. See Icons.
labelstringThe floating label for the field, and the select's accessible name unless aria-label is set. A filled select at density 2 or higher draws no label. For Text variants, it sets only the ARIA label. See Labels and errors.
namestringThe name the element's value is submitted under with its form. See Forms.
noAsteriskbooleandefault falseDisables the asterisk on the floating label, when the select is required. See Labels and errors.
requiredbooleandefault falseRequires an option to be chosen before the form can be submitted. See Labels and errors.
supportingTextstringConveys additional information below the select, such as how it should be used. See Labels and errors.
typeaheadDelaynumberdefault DEFAULT_TYPEAHEAD_BUFFER_TIMEThe longest pause, in milliseconds, between keystrokes of a typeahead search before the search starts again. See Menu content.
valueTItemThe currently selected option's value, of any type. An option matches it by compareWith, else by valueKey, else when the two are the same value (a number matches its own string). A value that matches no option is kept and nothing is shown selected; the option is selected when one with that value arrives. "" or null chooses nothing.Note: for SSR, set [selected] on the requested option and displayText rather than setting value. See Option values, Forms, Autofill.
valueKeystringThe field that identifies an object value: an option whose object holds the same value in this field as the select's object is its option, and the form submits this field.
variantFieldVariantTypeFieldVariant.Filled, .Outlined, .Textdefault FieldVariant.Filled, from the style configurationThe field's variant. See Variants.

Snippets⁠

SnippetDescription
childrenThe CsSelectOption elements to choose from.
containerSnippetCustom background content.
leadingIconSnippetThe leading icon, intended for a CsIcon or equivalent.
trailingIconSnippetThe trailing icon, intended for a CsIcon or equivalent. It replaces the dropdown arrow. While the select is in error, the arrow and any slotted element are hidden and an error icon shows; an element carrying the data-interactive attribute, such as a button, is a control and stays beside the icon.

Events⁠

PropTypeDescription
onChangeSelectionChangeEventFired on the select after its value changes: when a user chooses an option, an option's own selected changes, selectIndex() or reset() is called, or new express content no longer holds the value. detail.value is the typed value, null when nothing is chosen. Setting value from code does not fire it, nor does such a value's option arriving later. It bubbles. Its detail carries value and values.
onInputEventFired on the select after a user chooses an option, before change. Setting value from code does not fire it. It bubbles and is composed.
onBeforeToggleToggleEventFired when the select's menu is about to open or close. Cancelable: calling preventDefault() leaves the select as it is. newState is "open" or "closed". It bubbles, is composed, and is cancelable.
onToggleToggleEventFired when the select's menu has finished animations and opened or closed. newState is "open" or "closed". It bubbles and is composed.

Properties⁠

PropertyAttributeTypeDescription
defaultSelectedread-onlybooleanThe selected state the option returns to when the owning form, or the select's reset(), resets it. It comes from the selected attribute the option was written with, and later changes to selected do not alter it, as with the native HTMLOptionElement.defaultSelected.
disableddisabledbooleandefault falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
displayTextdisplay-textstringThe text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
flipLeadingIconInRtlflip-leading-icon-in-rtlbooleandefault falseFlips the leading icon supplied in leading-icon-name when the text direction is right to left. See Option icons.
flipTrailingIconInRtlflip-trailing-icon-in-rtlbooleandefault falseFlips the trailing icon supplied in trailing-icon-name when the text direction is right to left. See Option icons.
leadingIconNameleading-icon-namestringA leading Material Symbols icon name. This is an alternative to the start slot. If both are provided, the start slot takes precedence. See Option icons.
selectedselectedbooleandefault falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
trailingIconNametrailing-icon-namestringA trailing Material Symbols icon name. This is an alternative to the end slot. If both are provided, the end slot takes precedence. See Option icons.
valuevalueunknownThe item's value: the parent reports it as its own value when this item is chosen. Set from code it can be any value, such as a number or an object; the value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Slots⁠

SlotDescription
containerContent shown behind the item, such as a background image.
overlineA small text snippet above the headline.
(default)The headline/custom content.
supporting-textSupporting text lines underneath the headline.
startAny leading content, such as icons, avatars, or checkboxes.
endAny trailing content, such as icons and buttons.
trailing-supporting-textA small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Props⁠

PropTypeDescription
defaultSelectedread-only (ref)booleanThe selected state the option returns to when the owning form, or the select's reset(), resets it. It comes from the selected attribute the option was written with, and later changes to selected do not alter it, as with the native HTMLOptionElement.defaultSelected.
disabledbooleandefault falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
displayTextstringThe text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
flipLeadingIconInRtlbooleandefault falseFlips the leading icon supplied in leadingIconName when the text direction is right to left. See Option icons.
flipTrailingIconInRtlbooleandefault falseFlips the trailing icon supplied in trailingIconName when the text direction is right to left. See Option icons.
leadingIconNamestringA leading Material Symbols icon name. This is an alternative to the slot="start" child. If both are provided, the slot="start" child takes precedence. See Option icons.
selectedbooleandefault falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
trailingIconNamestringA trailing Material Symbols icon name. This is an alternative to the slot="end" child. If both are provided, the slot="end" child takes precedence. See Option icons.
valueunknownThe item's value: the parent reports it as its own value when this item is chosen. Set from code it can be any value, such as a number or an object; the value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Children⁠

ChildDescription
a child with slot="container"Content shown behind the item, such as a background image.
a child with slot="overline"A small text snippet above the headline.
childrenThe headline/custom content.
a child with slot="supporting-text"Supporting text lines underneath the headline.
a child with slot="start"Any leading content, such as icons, avatars, or checkboxes.
a child with slot="end"Any trailing content, such as icons and buttons.
a child with slot="trailing-supporting-text"A small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Parameters⁠

ParameterTypeDescription
Disabledbool?default falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
DisplayTextstring?The text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
FlipLeadingIconInRtlbool?default falseFlips the leading icon supplied in LeadingIconName when the text direction is right to left. See Option icons.
FlipTrailingIconInRtlbool?default falseFlips the trailing icon supplied in TrailingIconName when the text direction is right to left. See Option icons.
LeadingIconNamestring?A leading Material Symbols icon name. This is an alternative to the Start render fragment. If both are provided, the Start render fragment takes precedence. See Option icons.
Selectedbool?default falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
TrailingIconNamestring?A trailing Material Symbols icon name. This is an alternative to the End render fragment. If both are provided, the End render fragment takes precedence. See Option icons.
ValueTItemThe item's value: the parent reports it as its own Value when this item is chosen. Set from code it can be any value, such as a number or an object; the Value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Render fragments⁠

Once you write Container or any other fragment as a child element, the main content must go in an explicit <ChildContent> too; markup beside <Container> is a compile error; an @if or @foreach around a fragment is the same error: put the condition inside the fragment. Here ChildContent is: The headline/custom content.

<CbSelectOption>
    <Container>Content</Container>
    <ChildContent>Main content</ChildContent>
</CbSelectOption>
content_copy
ParameterTypeDescription
ChildContentRenderFragment?The headline/custom content.
ContainerRenderFragment?Content shown behind the item, such as a background image.
EndRenderFragment?Any trailing content, such as icons and buttons.
OverlineRenderFragment?A small text snippet above the headline.
StartRenderFragment?Any leading content, such as icons, avatars, or checkboxes.
SupportingTextRenderFragment?Supporting text lines underneath the headline.
TrailingSupportingTextRenderFragment?A small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Inputs⁠

InputTypeDescription
disabledbooleandefault falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
displayTextstringThe text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
flipLeadingIconInRtlbooleandefault falseFlips the leading icon supplied in leadingIconName when the text direction is right to left. See Option icons.
flipTrailingIconInRtlbooleandefault falseFlips the trailing icon supplied in trailingIconName when the text direction is right to left. See Option icons.
leadingIconNamestringA leading Material Symbols icon name. This is an alternative to the start slot. If both are provided, the start slot takes precedence. See Option icons.
selectedbooleandefault falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
trailingIconNamestringA trailing Material Symbols icon name. This is an alternative to the end slot. If both are provided, the end slot takes precedence. See Option icons.
valueunknownThe item's value: the parent reports it as its own value when this item is chosen. Set from code it can be any value, such as a number or an object; the value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Content projection⁠

ContentDescription
an element with slot="container"Content shown behind the item, such as a background image.
an element with slot="overline"A small text snippet above the headline.
content with no slotThe headline/custom content.
an element with slot="supporting-text"Supporting text lines underneath the headline.
an element with slot="start"Any leading content, such as icons, avatars, or checkboxes.
an element with slot="end"Any trailing content, such as icons and buttons.
an element with slot="trailing-supporting-text"A small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Props⁠

PropTypeDescription
disabledbooleandefault falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
displayTextstringThe text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
flipLeadingIconInRtlbooleandefault falseFlips the leading icon supplied in leadingIconName when the text direction is right to left. See Option icons.
flipTrailingIconInRtlbooleandefault falseFlips the trailing icon supplied in trailingIconName when the text direction is right to left. See Option icons.
leadingIconNamestringA leading Material Symbols icon name. This is an alternative to the start slot. If both are provided, the start slot takes precedence. See Option icons.
selectedbooleandefault falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
trailingIconNamestringA trailing Material Symbols icon name. This is an alternative to the end slot. If both are provided, the end slot takes precedence. See Option icons.
valueunknownThe item's value: the parent reports it as its own value when this item is chosen. Set from code it can be any value, such as a number or an object; the value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Slots⁠

SlotDescription
defaultThe headline/custom content.
containerContent shown behind the item, such as a background image.
endAny trailing content, such as icons and buttons.
overlineA small text snippet above the headline.
startAny leading content, such as icons, avatars, or checkboxes.
supporting-textSupporting text lines underneath the headline.
trailing-supporting-textA small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Props⁠

PropTypeDescription
disabledbooleandefault falseRemoves the item from the tab and arrow-key order, dims it and ignores the pointer. It sets no aria-disabled. See Disabled options, Disabled.
displayTextstringThe text that is displayed in the select field when selected. If not set, defaults to the default slot's text, then the supporting text. The typeahead text is never shown. See Menu content, Display text.
flipLeadingIconInRtlbooleandefault falseFlips the leading icon supplied in leadingIconName when the text direction is right to left. See Option icons.
flipTrailingIconInRtlbooleandefault falseFlips the trailing icon supplied in trailingIconName when the text direction is right to left. See Option icons.
leadingIconNamestringA leading Material Symbols icon name. This is an alternative to the startSnippet snippet. If both are provided, the startSnippet snippet takes precedence. See Option icons.
selectedbooleandefault falseMarks the option as the select's chosen option; choosing another option clears it. Set it in markup to choose the initial option. See Preselecting.
trailingIconNamestringA trailing Material Symbols icon name. This is an alternative to the endSnippet snippet. If both are provided, the endSnippet snippet takes precedence. See Option icons.
valueunknownThe item's value: the parent reports it as its own value when this item is chosen. Set from code it can be any value, such as a number or an object; the value attribute sets it to a string. See Option values, Forms, Autofill.

A select option does nothing outside a select. Setting selected from code updates the field and clears the other options.

In Blazor, value is the select's TItem, so a string value is written as C#: Value="@("light")". A bare Value="light" names a C# variable and does not compile.

Snippets⁠

SnippetDescription
containerSnippetContent shown behind the item, such as a background image.
overlineSnippetA small text snippet above the headline.
childrenThe headline/custom content.
supportingTextSnippetSupporting text lines underneath the headline.
startSnippetAny leading content, such as icons, avatars, or checkboxes.
endSnippetAny trailing content, such as icons and buttons.
trailingSupportingTextSnippetA small text snippet at the end of the item.

An overline together with supporting text, or supporting text with more than one child element, makes the row multiline.

Select Select option

Each attribute value has its own tokens; a cell shows its token's value, and selecting the cell shows the token's fallback path, with each name and value ready to copy. For example, the filled column's active-indicator-color row is --ct-field-filled-active-indicator-color, which defaults to --ct-sys-color-on-surface-variant.

Variant⁠

Namefilledoutlinedtext
active-indicator-color--ct-sys-color-on-surface-variant --ct-field-filled-active-indicator-color——
active-indicator-height1px --ct-field-filled-active-indicator-height——
bottom-space16px --ct-field-filled-bottom-space16px --ct-field-outlined-bottom-space—
container-color--ct-sys-color-surface-container-highest --ct-field-filled-container-color——
container-end-end-radius—--ct-sys-corner-radius-extra-small --ct-field-outlined-container-end-end-radius—
container-end-start-radius—--ct-sys-corner-radius-extra-small --ct-field-outlined-container-end-start-radius—
container-start-end-radius--ct-sys-corner-radius-extra-small --ct-field-filled-container-start-end-radius--ct-sys-corner-radius-extra-small --ct-field-outlined-container-start-end-radius—
container-start-start-radius--ct-sys-corner-radius-extra-small --ct-field-filled-container-start-start-radius--ct-sys-corner-radius-extra-small --ct-field-outlined-container-start-start-radius—
content-color--ct-sys-color-on-surface --ct-field-filled-content-color--ct-sys-color-on-surface --ct-field-outlined-content-color--ct-sys-color-on-surface --ct-field-text-content-color
content-font--ct-sys-typescale-body-large-font --ct-field-filled-content-font--ct-sys-typescale-body-large-font --ct-field-outlined-content-font--ct-sys-typescale-body-large-font --ct-field-text-content-font
content-line-height--ct-sys-typescale-body-large-line-height --ct-field-filled-content-line-height--ct-sys-typescale-body-large-line-height --ct-field-outlined-content-line-height--ct-sys-typescale-body-large-line-height --ct-field-text-content-line-height
content-size--ct-sys-typescale-body-large-size --ct-field-filled-content-size--ct-sys-typescale-body-large-size --ct-field-outlined-content-size--ct-sys-typescale-body-large-size --ct-field-text-content-size
content-space16px --ct-field-filled-content-space16px --ct-field-outlined-content-space—
content-tracking--ct-sys-typescale-body-large-tracking --ct-field-filled-content-tracking--ct-sys-typescale-body-large-tracking --ct-field-outlined-content-tracking—
content-weight--ct-sys-typescale-body-large-weight --ct-field-filled-content-weight--ct-sys-typescale-body-large-weight --ct-field-outlined-content-weight--ct-sys-typescale-body-large-weight --ct-field-text-content-weight
label-text-color--ct-sys-color-on-surface-variant --ct-field-filled-label-text-color--ct-sys-color-on-surface-variant --ct-field-outlined-label-text-color—
label-text-font--ct-sys-typescale-body-large-font --ct-field-filled-label-text-font--ct-sys-typescale-body-large-font --ct-field-outlined-label-text-font—
label-text-line-height--ct-sys-typescale-body-large-line-height --ct-field-filled-label-text-line-height--ct-sys-typescale-body-large-line-height --ct-field-outlined-label-text-line-height—
label-text-padding-bottom—8px --ct-field-outlined-label-text-padding-bottom—
label-text-populated-line-height--ct-sys-typescale-body-small-line-height --ct-field-filled-label-text-populated-line-height--ct-sys-typescale-body-small-line-height --ct-field-outlined-label-text-populated-line-height—
label-text-populated-size--ct-sys-typescale-body-small-size --ct-field-filled-label-text-populated-size--ct-sys-typescale-body-small-size --ct-field-outlined-label-text-populated-size—
label-text-size--ct-sys-typescale-body-large-size --ct-field-filled-label-text-size--ct-sys-typescale-body-large-size --ct-field-outlined-label-text-size—
label-text-weight--ct-sys-typescale-body-large-weight --ct-field-filled-label-text-weight--ct-sys-typescale-body-large-weight --ct-field-outlined-label-text-weight—
leading-content-color--ct-sys-color-on-surface-variant --ct-field-filled-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-leading-content-color—
leading-content-size24px --ct-field-filled-leading-content-size24px --ct-field-outlined-leading-content-size24px --ct-field-text-leading-content-size
leading-space16px --ct-field-filled-leading-space16px --ct-field-outlined-leading-space—
outline-color—--ct-sys-color-outline --ct-field-outlined-outline-color—
outline-label-padding—4px --ct-field-outlined-outline-label-padding—
outline-width—1px --ct-field-outlined-outline-width—
supporting-text-color--ct-sys-color-on-surface-variant --ct-field-filled-supporting-text-color--ct-sys-color-on-surface-variant --ct-field-outlined-supporting-text-color—
supporting-text-font--ct-sys-typescale-body-small-font --ct-field-filled-supporting-text-font--ct-sys-typescale-body-small-font --ct-field-outlined-supporting-text-font—
supporting-text-leading-space16px --ct-field-filled-supporting-text-leading-space16px --ct-field-outlined-supporting-text-leading-space—
supporting-text-line-height--ct-sys-typescale-body-small-line-height --ct-field-filled-supporting-text-line-height--ct-sys-typescale-body-small-line-height --ct-field-outlined-supporting-text-line-height—
supporting-text-size--ct-sys-typescale-body-small-size --ct-field-filled-supporting-text-size--ct-sys-typescale-body-small-size --ct-field-outlined-supporting-text-size—
supporting-text-top-space4px --ct-field-filled-supporting-text-top-space4px --ct-field-outlined-supporting-text-top-space—
supporting-text-tracking--ct-sys-typescale-body-small-tracking --ct-field-filled-supporting-text-tracking--ct-sys-typescale-body-small-tracking --ct-field-outlined-supporting-text-tracking—
supporting-text-trailing-space16px --ct-field-filled-supporting-text-trailing-space16px --ct-field-outlined-supporting-text-trailing-space—
supporting-text-weight--ct-sys-typescale-body-small-weight --ct-field-filled-supporting-text-weight--ct-sys-typescale-body-small-weight --ct-field-outlined-supporting-text-weight—
top-space16px --ct-field-filled-top-space16px --ct-field-outlined-top-space—
trailing-content-color--ct-sys-color-on-surface-variant --ct-field-filled-trailing-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-trailing-content-color—
trailing-content-size24px --ct-field-filled-trailing-content-size24px --ct-field-outlined-trailing-content-size24px --ct-field-text-trailing-content-size
trailing-space16px --ct-field-filled-trailing-space16px --ct-field-outlined-trailing-space—
with-label-bottom-space8px --ct-field-filled-with-label-bottom-space——
with-label-top-space8px --ct-field-filled-with-label-top-space——
with-leading-content-leading-space12px --ct-field-filled-with-leading-content-leading-space12px --ct-field-outlined-with-leading-content-leading-space—
with-trailing-content-trailing-space12px --ct-field-filled-with-trailing-content-trailing-space12px --ct-field-outlined-with-trailing-content-trailing-space—
hover-active-indicator-color--ct-sys-color-on-surface --ct-field-filled-hover-active-indicator-color——
hover-active-indicator-height1px --ct-field-filled-hover-active-indicator-height——
hover-content-color--ct-sys-color-on-surface --ct-field-filled-hover-content-color--ct-sys-color-on-surface --ct-field-outlined-hover-content-color—
hover-label-text-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-hover-label-text-color--ct-sys-color-on-surface-variant --ct-field-outlined-hover-label-text-color—
hover-leading-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-hover-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-hover-leading-content-color—
hover-outline-color—--ct-sys-color-on-surface --ct-field-outlined-hover-outline-color—
hover-outline-width—1px --ct-field-outlined-hover-outline-width—
hover-state-layer-color--ct-sys-color-on-surface --ct-field-filled-hover-state-layer-color--ct-sys-color-on-surface --ct-field-outlined-hover-state-layer-color—
hover-state-layer-opacity--ct-sys-state-hover-state-layer-opacity --ct-field-filled-hover-state-layer-opacity--ct-sys-state-hover-state-layer-opacity --ct-field-outlined-hover-state-layer-opacity—
hover-supporting-text-color--ct-sys-color-on-surface-variant --ct-field-filled-hover-supporting-text-color--ct-sys-color-on-surface-variant --ct-field-outlined-hover-supporting-text-color—
hover-trailing-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-hover-trailing-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-hover-trailing-content-color—
focus-active-indicator-color--ct-sys-color-primary --ct-field-filled-focus-active-indicator-color——
focus-active-indicator-height3px --ct-field-filled-focus-active-indicator-height——
focus-content-color--ct-sys-color-on-surface --ct-field-filled-focus-content-color--ct-sys-color-on-surface --ct-field-outlined-focus-content-color—
focus-hover-label-text-color--ct-sys-color-primary-hover --ct-field-filled-focus-hover-label-text-colorsame as focus-label-text-color --ct-field-outlined-focus-hover-label-text-color—
focus-hover-leading-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-focus-hover-leading-content-colorsame as focus-leading-content-color --ct-field-outlined-focus-hover-leading-content-color—
focus-hover-trailing-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-focus-hover-trailing-content-colorsame as focus-trailing-content-color --ct-field-outlined-focus-hover-trailing-content-color—
focus-label-text-color--ct-sys-color-primary --ct-field-filled-focus-label-text-color--ct-sys-color-primary --ct-field-outlined-focus-label-text-color—
focus-leading-content-color--ct-sys-color-on-surface-variant --ct-field-filled-focus-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-focus-leading-content-color—
focus-outline-color—--ct-sys-color-primary --ct-field-outlined-focus-outline-color--ct-sys-color-primary --ct-field-text-focus-outline-color
focus-outline-width—2px --ct-field-outlined-focus-outline-width2px --ct-field-text-focus-outline-width
focus-supporting-text-color--ct-sys-color-on-surface-variant --ct-field-filled-focus-supporting-text-color--ct-sys-color-on-surface-variant --ct-field-outlined-focus-supporting-text-color—
focus-trailing-content-color--ct-sys-color-on-surface-variant --ct-field-filled-focus-trailing-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-focus-trailing-content-color—
disabled-active-indicator-color--ct-sys-color-on-surface --ct-field-filled-disabled-active-indicator-color——
disabled-active-indicator-height1px --ct-field-filled-disabled-active-indicator-height——
disabled-active-indicator-opacity0.38 --ct-field-filled-disabled-active-indicator-opacity——
disabled-container-color--ct-sys-color-on-surface --ct-field-filled-disabled-container-color——
disabled-container-opacity0.04 --ct-field-filled-disabled-container-opacity——
disabled-content-color--ct-sys-color-on-surface --ct-field-filled-disabled-content-color--ct-sys-color-on-surface --ct-field-outlined-disabled-content-color--ct-sys-color-on-surface --ct-field-text-disabled-content-color
disabled-content-opacity0.38 --ct-field-filled-disabled-content-opacity0.38 --ct-field-outlined-disabled-content-opacity0.38 --ct-field-text-disabled-content-opacity
disabled-label-text-color--ct-sys-color-on-surface --ct-field-filled-disabled-label-text-color--ct-sys-color-on-surface --ct-field-outlined-disabled-label-text-color—
disabled-label-text-opacity0.38 --ct-field-filled-disabled-label-text-opacity0.38 --ct-field-outlined-disabled-label-text-opacity—
disabled-leading-content-color--ct-sys-color-on-surface --ct-field-filled-disabled-leading-content-color--ct-sys-color-on-surface --ct-field-outlined-disabled-leading-content-color—
disabled-leading-content-opacity0.38 --ct-field-filled-disabled-leading-content-opacity0.38 --ct-field-outlined-disabled-leading-content-opacity—
disabled-outline-color—--ct-sys-color-on-surface --ct-field-outlined-disabled-outline-color—
disabled-outline-opacity—0.12 --ct-field-outlined-disabled-outline-opacity—
disabled-outline-width—1px --ct-field-outlined-disabled-outline-width—
disabled-supporting-text-color--ct-sys-color-on-surface --ct-field-filled-disabled-supporting-text-color--ct-sys-color-on-surface --ct-field-outlined-disabled-supporting-text-color—
disabled-supporting-text-opacity0.38 --ct-field-filled-disabled-supporting-text-opacity0.38 --ct-field-outlined-disabled-supporting-text-opacity—
disabled-trailing-content-color--ct-sys-color-on-surface --ct-field-filled-disabled-trailing-content-color--ct-sys-color-on-surface --ct-field-outlined-disabled-trailing-content-color—
disabled-trailing-content-opacity0.38 --ct-field-filled-disabled-trailing-content-opacity0.38 --ct-field-outlined-disabled-trailing-content-opacity—
error-active-indicator-color--ct-sys-color-error --ct-field-filled-error-active-indicator-color——
error-content-color--ct-sys-color-on-surface --ct-field-filled-error-content-color--ct-sys-color-on-surface --ct-field-outlined-error-content-color--ct-sys-color-error --ct-field-text-error-content-color
error-focus-active-indicator-color--ct-sys-color-error --ct-field-filled-error-focus-active-indicator-color——
error-focus-content-color--ct-sys-color-on-surface --ct-field-filled-error-focus-content-color--ct-sys-color-on-surface --ct-field-outlined-error-focus-content-color—
error-focus-hover-label-text-color--ct-sys-color-error-hover --ct-field-filled-error-focus-hover-label-text-colorsame as error-focus-label-text-color --ct-field-outlined-error-focus-hover-label-text-color—
error-focus-hover-leading-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-error-focus-hover-leading-content-colorsame as error-focus-leading-content-color --ct-field-outlined-error-focus-hover-leading-content-color—
error-focus-hover-trailing-content-color--ct-sys-color-error-hover --ct-field-filled-error-focus-hover-trailing-content-colorsame as error-focus-trailing-content-color --ct-field-outlined-error-focus-hover-trailing-content-color—
error-focus-label-text-color--ct-sys-color-error --ct-field-filled-error-focus-label-text-color--ct-sys-color-error --ct-field-outlined-error-focus-label-text-color—
error-focus-leading-content-color--ct-sys-color-on-surface-variant --ct-field-filled-error-focus-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-error-focus-leading-content-color—
error-focus-outline-color—--ct-sys-color-error --ct-field-outlined-error-focus-outline-color—
error-focus-supporting-text-color--ct-sys-color-error --ct-field-filled-error-focus-supporting-text-color--ct-sys-color-error --ct-field-outlined-error-focus-supporting-text-color—
error-focus-trailing-content-color--ct-sys-color-error --ct-field-filled-error-focus-trailing-content-color--ct-sys-color-error --ct-field-outlined-error-focus-trailing-content-color—
error-hover-active-indicator-color--ct-sys-color-error --ct-field-filled-error-hover-active-indicator-color——
error-hover-content-color--ct-sys-color-on-surface --ct-field-filled-error-hover-content-color--ct-sys-color-on-surface --ct-field-outlined-error-hover-content-color—
error-hover-label-text-color--ct-sys-color-error-hover --ct-field-filled-error-hover-label-text-color--ct-sys-color-error --ct-field-outlined-error-hover-label-text-color—
error-hover-leading-content-color--ct-sys-color-on-surface-variant-hover --ct-field-filled-error-hover-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-error-hover-leading-content-color—
error-hover-outline-color—--ct-sys-color-error --ct-field-outlined-error-hover-outline-color—
error-hover-state-layer-color--ct-sys-color-on-surface --ct-field-filled-error-hover-state-layer-color——
error-hover-state-layer-opacity--ct-sys-state-hover-state-layer-opacity --ct-field-filled-error-hover-state-layer-opacity——
error-hover-supporting-text-color--ct-sys-color-error --ct-field-filled-error-hover-supporting-text-color--ct-sys-color-error --ct-field-outlined-error-hover-supporting-text-color—
error-hover-trailing-content-color--ct-sys-color-error-hover --ct-field-filled-error-hover-trailing-content-color--ct-sys-color-error --ct-field-outlined-error-hover-trailing-content-color—
error-label-text-color--ct-sys-color-error --ct-field-filled-error-label-text-color--ct-sys-color-error --ct-field-outlined-error-label-text-color—
error-leading-content-color--ct-sys-color-on-surface-variant --ct-field-filled-error-leading-content-color--ct-sys-color-on-surface-variant --ct-field-outlined-error-leading-content-color—
error-outline-color—--ct-sys-color-error --ct-field-outlined-error-outline-color—
error-supporting-text-color--ct-sys-color-error --ct-field-filled-error-supporting-text-color--ct-sys-color-error --ct-field-outlined-error-supporting-text-color—
error-trailing-content-color--ct-sys-color-error --ct-field-filled-error-trailing-content-color--ct-sys-color-error --ct-field-outlined-error-trailing-content-color—

A value is what the token defaults to; selecting it copies the token's name.

Tokens⁠

TokenValue
--ct-menu-item-bottom-space12px --ct-menu-item-bottom-space
--ct-menu-item-container-colortransparent --ct-menu-item-container-color
--ct-menu-item-disabled-opacity0.38 --ct-menu-item-disabled-opacity
--ct-menu-item-hover-label-text-color--ct-sys-color-on-surface-hover --ct-menu-item-hover-label-text-color
--ct-menu-item-hover-leading-icon-color--ct-sys-color-on-surface-variant-hover --ct-menu-item-hover-leading-icon-color
--ct-menu-item-hover-overline-color--ct-sys-color-on-surface-variant-hover --ct-menu-item-hover-overline-color
--ct-menu-item-hover-state-layer-color--ct-sys-color-on-surface --ct-menu-item-hover-state-layer-color
--ct-menu-item-hover-state-layer-opacity--ct-sys-state-hover-state-layer-opacity --ct-menu-item-hover-state-layer-opacity
--ct-menu-item-hover-supporting-text-color--ct-sys-color-on-surface-variant-hover --ct-menu-item-hover-supporting-text-color
--ct-menu-item-hover-trailing-icon-color--ct-sys-color-on-surface-variant-hover --ct-menu-item-hover-trailing-icon-color
--ct-menu-item-hover-trailing-supporting-text-color--ct-sys-color-on-surface-variant-hover --ct-menu-item-hover-trailing-supporting-text-color
--ct-menu-item-label-text-color--ct-sys-color-on-surface --ct-menu-item-label-text-color
--ct-menu-item-label-text-font--ct-sys-typescale-body-large-font --ct-menu-item-label-text-font
--ct-menu-item-label-text-line-height--ct-sys-typescale-body-large-line-height --ct-menu-item-label-text-line-height
--ct-menu-item-label-text-size--ct-sys-typescale-body-large-size --ct-menu-item-label-text-size
--ct-menu-item-label-text-tracking--ct-sys-typescale-body-large-tracking --ct-menu-item-label-text-tracking
--ct-menu-item-label-text-weight--ct-sys-typescale-body-large-weight --ct-menu-item-label-text-weight
--ct-menu-item-leading-icon-color--ct-sys-color-on-surface-variant --ct-menu-item-leading-icon-color
--ct-menu-item-leading-icon-size24px --ct-menu-item-leading-icon-size
--ct-menu-item-leading-space16px --ct-menu-item-leading-space
--ct-menu-item-one-line-container-height56px --ct-menu-item-one-line-container-height
--ct-menu-item-overline-color--ct-sys-color-on-surface-variant --ct-menu-item-overline-color
--ct-menu-item-overline-font--ct-sys-typescale-label-small-font --ct-menu-item-overline-font
--ct-menu-item-overline-line-height--ct-sys-typescale-label-small-line-height --ct-menu-item-overline-line-height
--ct-menu-item-overline-size--ct-sys-typescale-label-small-size --ct-menu-item-overline-size
--ct-menu-item-overline-tracking--ct-sys-typescale-label-small-tracking --ct-menu-item-overline-tracking
--ct-menu-item-overline-weight--ct-sys-typescale-label-small-weight --ct-menu-item-overline-weight
--ct-menu-item-pressed-label-text-color--ct-sys-color-on-surface-pressed --ct-menu-item-pressed-label-text-color
--ct-menu-item-pressed-leading-icon-color--ct-sys-color-on-surface-variant-pressed --ct-menu-item-pressed-leading-icon-color
--ct-menu-item-pressed-overline-color--ct-sys-color-on-surface-variant-pressed --ct-menu-item-pressed-overline-color
--ct-menu-item-pressed-state-layer-color--ct-sys-color-on-surface --ct-menu-item-pressed-state-layer-color
--ct-menu-item-pressed-state-layer-opacity--ct-sys-state-pressed-state-layer-opacity --ct-menu-item-pressed-state-layer-opacity
--ct-menu-item-pressed-supporting-text-color--ct-sys-color-on-surface-variant-pressed --ct-menu-item-pressed-supporting-text-color
--ct-menu-item-pressed-trailing-icon-color--ct-sys-color-on-surface-variant-pressed --ct-menu-item-pressed-trailing-icon-color
--ct-menu-item-pressed-trailing-supporting-text-color--ct-sys-color-on-surface-variant-pressed --ct-menu-item-pressed-trailing-supporting-text-color
--ct-menu-item-selected-container-color--ct-sys-color-secondary-container --ct-menu-item-selected-container-color
--ct-menu-item-selected-hover-label-text-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-label-text-color
--ct-menu-item-selected-hover-leading-icon-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-leading-icon-color
--ct-menu-item-selected-hover-overline-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-overline-color
--ct-menu-item-selected-hover-state-layer-color--ct-sys-color-on-secondary-container-state-layer --ct-menu-item-selected-hover-state-layer-color
--ct-menu-item-selected-hover-supporting-text-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-supporting-text-color
--ct-menu-item-selected-hover-trailing-icon-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-trailing-icon-color
--ct-menu-item-selected-hover-trailing-supporting-text-color--ct-sys-color-on-secondary-container-hover --ct-menu-item-selected-hover-trailing-supporting-text-color
--ct-menu-item-selected-label-text-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-label-text-color
--ct-menu-item-selected-leading-icon-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-leading-icon-color
--ct-menu-item-selected-overline-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-overline-color
--ct-menu-item-selected-pressed-label-text-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-label-text-color
--ct-menu-item-selected-pressed-leading-icon-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-leading-icon-color
--ct-menu-item-selected-pressed-overline-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-overline-color
--ct-menu-item-selected-pressed-state-layer-color--ct-sys-color-on-secondary-container-state-layer --ct-menu-item-selected-pressed-state-layer-color
--ct-menu-item-selected-pressed-supporting-text-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-supporting-text-color
--ct-menu-item-selected-pressed-trailing-icon-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-trailing-icon-color
--ct-menu-item-selected-pressed-trailing-supporting-text-color--ct-sys-color-on-secondary-container-pressed --ct-menu-item-selected-pressed-trailing-supporting-text-color
--ct-menu-item-selected-supporting-text-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-supporting-text-color
--ct-menu-item-selected-trailing-icon-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-trailing-icon-color
--ct-menu-item-selected-trailing-supporting-text-color--ct-sys-color-on-secondary-container --ct-menu-item-selected-trailing-supporting-text-color
--ct-menu-item-supporting-text-color--ct-sys-color-on-surface-variant --ct-menu-item-supporting-text-color
--ct-menu-item-supporting-text-font--ct-sys-typescale-body-medium-font --ct-menu-item-supporting-text-font
--ct-menu-item-supporting-text-line-height--ct-sys-typescale-body-medium-line-height --ct-menu-item-supporting-text-line-height
--ct-menu-item-supporting-text-size--ct-sys-typescale-body-medium-size --ct-menu-item-supporting-text-size
--ct-menu-item-supporting-text-tracking--ct-sys-typescale-body-medium-tracking --ct-menu-item-supporting-text-tracking
--ct-menu-item-supporting-text-weight--ct-sys-typescale-body-medium-weight --ct-menu-item-supporting-text-weight
--ct-menu-item-top-space12px --ct-menu-item-top-space
--ct-menu-item-trailing-icon-color--ct-sys-color-on-surface-variant --ct-menu-item-trailing-icon-color
--ct-menu-item-trailing-icon-size24px --ct-menu-item-trailing-icon-size
--ct-menu-item-trailing-space16px --ct-menu-item-trailing-space
--ct-menu-item-trailing-supporting-text-color--ct-sys-color-on-surface-variant --ct-menu-item-trailing-supporting-text-color
--ct-menu-item-trailing-supporting-text-font--ct-sys-typescale-label-small-font --ct-menu-item-trailing-supporting-text-font
--ct-menu-item-trailing-supporting-text-line-height--ct-sys-typescale-label-small-line-height --ct-menu-item-trailing-supporting-text-line-height
--ct-menu-item-trailing-supporting-text-size--ct-sys-typescale-label-small-size --ct-menu-item-trailing-supporting-text-size
--ct-menu-item-trailing-supporting-text-tracking--ct-sys-typescale-label-small-tracking --ct-menu-item-trailing-supporting-text-tracking
--ct-menu-item-trailing-supporting-text-weight--ct-sys-typescale-label-small-weight --ct-menu-item-trailing-supporting-text-weight

Names and states⁠

A screen reader announces the select as a combobox that opens a listbox menu, as described in the WAI-ARIA Authoring Practices: Select-Only Combobox Example.

  • The select takes its name from its aria-label, or from label when there is no aria-label, in every variant.
  • The menu takes its name from label, or from aria-label when there is no label.
  • aria-label is the only ARIA attribute that changes what a screen reader announces. Any other aria-* attribute you set has no effect.
  • The select is announced as expanded while the menu is open and as collapsed otherwise, and the description is announced with it.
  • The description is error-text while error is set and the text is not empty, and supporting-text otherwise.
  • With autocomplete set, the select renders a hidden native <select> that carries the token for the browser to fill. It is hidden from screen readers and out of the Tab order, and holds up to 300 options; a longer list renders none and the browser cannot fill the select.
  • The field is announced as required while required is set, and as invalid while it is in error, set by error or by a validation error. An error icon replaces the arrow, and the icon is hidden from screen readers, because the invalid state already announces the error. The arrow is decoration, not a control: it cannot take focus or be clicked on its own, so it is hidden in error. Content you place in the trailing-icon slot is hidden too, unless the element carries the data-interactive attribute, which marks it as a control that stays beside the error icon.
  • A disabled select is announced as dimmed or unavailable.
  • Each option is announced as a listbox option, with its selected state. An option takes its name from its aria-label, or else its default slot text, and display-text changes only what the field shows.
  • A change to an option's selected after the first render is announced; an option selected in markup carries its selected state from the first render.
  • An option that holds only an icon has no text for a name: give it an aria-label.
  • Mark a decorative icon in a slot aria-hidden="true", so it adds nothing to what a screen reader announces.
  • For a short list the reader should see in full, a radio button group suits the job better.

Keyboard and focus⁠

Key Action
Tab Moves focus to the field
Enter, Space, Down Arrow, Up Arrow, Home Opens the menu and focuses the selected option, or the first option when none is selected
End Opens the menu and starts at the last option, or at the match while a search is under way
A printable character With the menu closed, selects the first option whose text matches the typed letters; Space is part of the typed text while a search is under way
Down Arrow, Up Arrow With the menu open, moves between options without wrapping at the ends
Enter, Space With the menu open, selects the focused option, then closes the menu
Escape With the menu open, closes it without changing the selection

The select handles all of these keys itself, so they work the same in every browser.

  • Typed letters count as one search until typeahead-delay passes without a key.
  • An opening key pressed during a search opens the menu on the matching option, and the search goes on there: letters typed next, even while the menu is still opening, extend it. A click opens the menu with a fresh search.
  • Typeahead matches the start of an option's aria-label when it has one, or its slot text, and never a disabled option. The field always shows the option's visible text.
  • The field shows a focus ring on keyboard focus.
  • disabled removes the field from the Tab order, and on an option it stops the row taking focus or a click.
  • An option shows a focus ring inside its edge on keyboard focus.
  • Focus leaving the select and its menu closes the menu.

Pointer and touch⁠

  • The whole field opens the menu, and the select is at least 210 pixels wide.
  • A click on an option selects it and closes the menu. A one-line option is 56 pixels tall by default.
  • The field's height changes with density. Check the height you choose against the 24 by 24 pixel minimum of WCAG 2.5.8; the density example shows each step.

Display settings⁠

  • Forced colors: the text variant draws its focus ring in Highlight, and a disabled text variant uses GrayText at full opacity. The selected option gets a 3 pixel double border in the text color, and a disabled option takes GrayText.
  • Reduced motion: the arrow's rotation and the animation still run when a reader asks for less motion. Set animation to none to stop them.
  • Right-to-left: the trailing arrow turns the opposite way when the menu opens. An option's icons mirror only where you set a flip member on it.

Standards⁠

With its defaults, the select meets two WCAG 2.2 success criteria:

Six more depend on how you use it:

  • 1.1.1 Non-text Content (A): mark a decorative icon or image in a slot aria-hidden="true", or give a meaningful one a text alternative.
  • 1.3.5 Identify Input Purpose (AA): a select that collects the user's own details, such as a birth month or a card expiry month, needs autocomplete with the matching token.
  • 2.5.8 Target Size (Minimum) (AA): check the field's height at the density you choose against 24 by 24 pixels.
  • 3.3.1 Error Identification (A): set error with an error-text that says what is wrong. The select supplies the error icon and the color, and writes no message of its own. While error is set it shows error-text only, never the browser's validation message. Without error-text or a browser validation message, it logs a console warning. If your page shows the message elsewhere, such as in an error summary, set minConsoleLoggingLevel to "error" in the application configuration to silence the warning.
  • 3.3.2 Labels or Instructions (A): set label, and supporting-text where the choice needs explaining.
  • 4.1.2 Name, Role, Value (A): give every select a label, or an aria-label where no label shows, and set aria-label on an option that holds only an icon.