Multi-select
A text field that collects several values as removable tags, filtering a list of options as the reader types.
Chai tea, 24 bags is reordered at each of these warehouses.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem,} from '@slotted/react/multi-select';const WAREHOUSES = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' }, { value: 'ONT', label: 'Ontario, CA' }, { value: 'ABE', label: 'Allentown, PA' },];export default function MultiSelectBasic() { return ( <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription> Chai tea, 24 bags is reordered at each of these warehouses. </FieldDescription> </Field> );}Installation
The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.
pnpm add @slotted/react @slotted/theme @slotted/themesimport { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectGroup, MultiSelectItem, MultiSelectSeparator } from '@slotted/react';Initial value
defaultValue in React and a one-way [value] in Angular set the values the control starts with, in the order the tags are drawn. Pass items, the list of values and labels, whenever the control starts with values: in React the options are rendered only while the list is open, so without items a tag shows its raw value, such as RNO, until the list first opens.
Earl Grey, 100 bags is stocked at two warehouses.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' }, { value: 'ONT', label: 'Ontario, CA' }, { value: 'ABE', label: 'Allentown, PA' },];export default function MultiSelectInitialValue() { return ( <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect defaultValue={['RNO', 'CMH']} items={WAREHOUSES}> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription>Earl Grey, 100 bags is stocked at two warehouses.</FieldDescription> </Field> );}Sizes
size sets the control to one step of the control scale: sm for toolbars and dense tables, md for most forms, lg for sparse forms. An empty multi-select is the height of a text field of the same size; each row of tags adds to it. Inside a field, an unset size follows the field.
import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' },];const SIZES = [ { size: 'sm', label: 'Filter by warehouse' }, { size: 'md', label: 'Stocking warehouses' }, { size: 'lg', label: 'Return warehouses' },] as const;export default function MultiSelectSizes() { return ( <Stack gap={5}> {SIZES.map(({ size, label }) => ( <Field key={size} size={size}> <FieldLabel>{label}</FieldLabel> <MultiSelect defaultValue={['RNO', 'CMH']} items={WAREHOUSES}> <MultiSelectControl /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> ))} </Stack> );}Variants
outline is the default frame. subtle fills the control, for a form on a tinted surface. plain draws no frame at rest, for a table cell, and still shows hover and focus.
import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const CHANNELS: MultiSelectOption[] = [ { value: 'web', label: 'Web store' }, { value: 'marketplace', label: 'Marketplace' }, { value: 'wholesale', label: 'Wholesale' }, { value: 'phone', label: 'Phone orders' },];const VARIANTS = [ { variant: 'outline', label: 'Sales channels' }, { variant: 'subtle', label: 'Promotion channels' }, { variant: 'plain', label: 'Report channels' },] as const;export default function MultiSelectVariants() { return ( <Stack gap={5}> {VARIANTS.map(({ variant, label }) => ( <Field key={variant}> <FieldLabel>{label}</FieldLabel> <MultiSelect variant={variant} defaultValue={['web', 'wholesale']} items={CHANNELS}> <MultiSelectControl /> <MultiSelectContent> {CHANNELS.map((channel) => ( <MultiSelectItem key={channel.value} value={channel.value}> {channel.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> ))} </Stack> );}States
Set invalid, readOnly and disabled on the field, which passes them to the multi-select; each can also be set on the multi-select itself. Invalid draws the border and the focus ring in the danger tone and sets aria-invalid on the input. Read-only keeps the tags legible and the input focusable, and removes the remove buttons, the clear button and the list. Disabled does the same and takes the control out of the tab order.
Error:Choose at least one warehouse before publishing.
Updated by the nightly inventory sync.
Transfers open once the purchase order is received.
import { Field, FieldDescription, FieldError, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' },];const options = WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem>));export default function MultiSelectStates() { return ( <Stack gap={5}> <Field invalid required> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect items={WAREHOUSES}> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldError>Choose at least one warehouse before publishing.</FieldError> </Field> <Field readOnly> <FieldLabel>Warehouses holding stock</FieldLabel> <MultiSelect defaultValue={['RNO', 'SAV']} items={WAREHOUSES}> <MultiSelectControl /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>Updated by the nightly inventory sync.</FieldDescription> </Field> <Field disabled> <FieldLabel>Transfer warehouses</FieldLabel> <MultiSelect defaultValue={['CMH']} items={WAREHOUSES}> <MultiSelectControl /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>Transfers open once the purchase order is received.</FieldDescription> </Field> </Stack> );}Groups
MultiSelectGroup in React and sl-multi-select-group in Angular put a run of options under a heading, which assistive technology reads with each option. MultiSelectSeparator and sl-multi-select-separator draw a line between runs. A group whose options were all filtered away disappears with its heading: type dallas to see only Central.
import { Fragment } from 'react';import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectGroup, MultiSelectItem, type MultiSelectOptionGroup, MultiSelectSeparator,} from '@slotted/react/multi-select';const REGIONS: MultiSelectOptionGroup[] = [ { label: 'West', options: [ { value: 'RNO', label: 'Reno, NV' }, { value: 'ONT', label: 'Ontario, CA' }, { value: 'SEA', label: 'Kent, WA' }, ], }, { label: 'Central', options: [ { value: 'DFW', label: 'Dallas, TX' }, { value: 'JOT', label: 'Joliet, IL' }, { value: 'CMH', label: 'Columbus, OH' }, ], }, { label: 'East', options: [ { value: 'SAV', label: 'Savannah, GA' }, { value: 'ABE', label: 'Allentown, PA' }, { value: 'EWR', label: 'Edison, NJ' }, ], },];export default function MultiSelectGroups() { return ( <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect defaultValue={['RNO', 'SAV']} items={REGIONS}> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {REGIONS.map((region, index) => ( <Fragment key={region.label}> {index > 0 && <MultiSelectSeparator />} <MultiSelectGroup label={region.label}> {region.options.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectGroup> </Fragment> ))} </MultiSelectContent> </MultiSelect> </Field> );}Icons and descriptions
icon fills the first column of an option and description writes a second line under its label. In React icon takes any element; in Angular it names a glyph. The filter compares the label only.
import { Field, FieldLabel } from '@slotted/react/field';import { Glyph, type GlyphName, Icon } from '@slotted/react/icon';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const DOCUMENTS: (MultiSelectOption & { icon: GlyphName; description: string })[] = [ { value: 'invoice', label: 'Invoice', icon: 'file-text', description: 'PDF, issued when the order ships', }, { value: 'packing-slip', label: 'Packing slip', icon: 'file', description: 'PDF, one page per parcel', }, { value: 'customs', label: 'Customs declaration', icon: 'file-spreadsheet', description: 'CN23, international orders only', }, { value: 'photos', label: 'Product photos', icon: 'file-image', description: 'Up to five images per line item', },];export default function MultiSelectDescriptions() { return ( <Field> <FieldLabel>Attach to the shipping email</FieldLabel> <MultiSelect defaultValue={['invoice']} items={DOCUMENTS}> <MultiSelectControl placeholder="Add a document" /> <MultiSelectContent> {DOCUMENTS.map((document) => ( <MultiSelectItem key={document.value} value={document.value} description={document.description} icon={ <Icon> <Glyph name={document.icon} /> </Icon> } > {document.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> );}Disabled options
A disabled option stays in the list, is announced as unavailable, and is skipped by every movement key. Put the reason in its description, so the reader knows why it cannot be chosen.
import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const WAREHOUSES: (MultiSelectOption & { description: string })[] = [ { value: 'RNO', label: 'Reno, NV', description: '142 pallet spaces free' }, { value: 'CMH', label: 'Columbus, OH', description: '38 pallet spaces free' }, { value: 'SAV', label: 'Savannah, GA', description: 'At capacity until November 3', disabled: true, }, { value: 'DFW', label: 'Dallas, TX', description: '210 pallet spaces free' }, { value: 'ONT', label: 'Ontario, CA', description: 'Closed for a stock count this week', disabled: true, },];export default function MultiSelectDisabledOptions() { return ( <Field> <FieldLabel>Receiving warehouses</FieldLabel> <MultiSelect defaultValue={['RNO']} items={WAREHOUSES}> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value} description={warehouse.description} disabled={warehouse.disabled ?? false} > {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> );}Filtering
Typing filters the list. The default comparison is a locale-sensitive “contains” that ignores accents and case, so malmo finds Malmö, and the matched span is marked. locale sets the language of the comparison when it differs from the page; highlightMatch={false} turns the mark off. Choosing an option empties the typed text and keeps the list open for the next value.
Type “zur” or “malmo”: accents and case are ignored.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem,} from '@slotted/react/multi-select';const CITIES = [ { value: 'cdz', label: 'Cádiz, Spain' }, { value: 'dus', label: 'Düsseldorf, Germany' }, { value: 'krk', label: 'Kraków, Poland' }, { value: 'mmx', label: 'Malmö, Sweden' }, { value: 'yul', label: 'Montréal, Canada' }, { value: 'gru', label: 'São Paulo, Brazil' }, { value: 'zrh', label: 'Zürich, Switzerland' }, { value: 'aar', label: 'Aarhus, Denmark' },];export default function MultiSelectFiltering() { return ( <Field> <FieldLabel>Distributor cities</FieldLabel> <MultiSelect> <MultiSelectControl placeholder="Search cities" /> <MultiSelectContent> {CITIES.map((city) => ( <MultiSelectItem key={city.value} value={city.value}> {city.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription>Type “zur” or “malmo”: accents and case are ignored.</FieldDescription> </Field> );}Limiting the number of values
max caps the set. A counter such as 2 of 3 sits in the control while max is set. At the limit the counter changes tone, the root carries data-complete, every option not yet chosen is announced as unavailable, and a live message says the limit was reached. Removing a tag frees a place again.
The storefront home page shows up to three categories.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const CATEGORIES: MultiSelectOption[] = [ { value: 'beverages', label: 'Beverages' }, { value: 'condiments', label: 'Condiments' }, { value: 'confections', label: 'Confections' }, { value: 'dairy', label: 'Dairy products' }, { value: 'grains', label: 'Grains and cereals' }, { value: 'meat', label: 'Meat and poultry' }, { value: 'produce', label: 'Produce' }, { value: 'seafood', label: 'Seafood' },];export default function MultiSelectLimit() { return ( <Field> <FieldLabel>Featured categories</FieldLabel> <MultiSelect max={3} defaultValue={['beverages', 'confections']} items={CATEGORIES}> <MultiSelectControl placeholder="Add a category" /> <MultiSelectContent> {CATEGORIES.map((category) => ( <MultiSelectItem key={category.value} value={category.value}> {category.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription>The storefront home page shows up to three categories.</FieldDescription> </Field> );}Overflow
overflow="wrap", the default, keeps every tag in view: the control grows by whole rows up to three, then scrolls inside its frame. overflow="collapse" keeps the control one row high and counts the tags that do not fit in a +N tag; pressing it opens the list, whose top band lists every chosen value.
Wrap: every chip stays in view, up to three rows.
Collapse: one row, and a count of the rest.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'ONT', label: 'Ontario, CA' }, { value: 'SEA', label: 'Kent, WA' }, { value: 'DFW', label: 'Dallas, TX' }, { value: 'JOT', label: 'Joliet, IL' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'ABE', label: 'Allentown, PA' }, { value: 'EWR', label: 'Edison, NJ' },];const STOCKED = ['RNO', 'ONT', 'SEA', 'DFW', 'JOT', 'CMH', 'SAV'];const options = WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem>));export default function MultiSelectOverflow() { return ( <Stack gap={5}> <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect overflow="wrap" defaultValue={STOCKED} items={WAREHOUSES}> <MultiSelectControl /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>Wrap: every chip stays in view, up to three rows.</FieldDescription> </Field> <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect overflow="collapse" defaultValue={STOCKED} items={WAREHOUSES}> <MultiSelectControl /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>Collapse: one row, and a count of the rest.</FieldDescription> </Field> </Stack> );}Creating values
With creatable, text the list does not hold becomes a value. Once nothing in the list matches, the list offers to add the text; Enter, a comma or leaving the control commits it. delimiters sets the characters that commit, and commitOnBlur={false} keeps the text when focus leaves. A value already in the set is refused, compared without regard to case or accents, and focus moves to the tag that holds it.
Type a keyword and press Enter or a comma. Shoppers find Chai tea, 24 bags by these words.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const SUGGESTED: MultiSelectOption[] = [ { value: 'chai', label: 'chai' }, { value: 'black tea', label: 'black tea' }, { value: 'spiced', label: 'spiced' }, { value: 'loose leaf', label: 'loose leaf' }, { value: 'caffeinated', label: 'caffeinated' }, { value: 'gift', label: 'gift' },];export default function MultiSelectCreatable() { return ( <Field> <FieldLabel>Search keywords</FieldLabel> <MultiSelect creatable defaultValue={['chai', 'black tea']} items={SUGGESTED}> <MultiSelectControl placeholder="Add a keyword" /> <MultiSelectContent> {SUGGESTED.map((keyword) => ( <MultiSelectItem key={keyword.value} value={keyword.value}> {keyword.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription> Type a keyword and press Enter or a comma. Shoppers find Chai tea, 24 bags by these words. </FieldDescription> </Field> );}Pasting and validating typed values
A paste that contains delimiters becomes several values at once; addOnPaste={false} keeps it as text. validateValue decides whether typed text may become a value. Every value turned away, by the predicate, as a duplicate or over max, is reported through onValueRefuse in React and (valueRefuse) in Angular with its cause, so the page can say why. Paste buyers@northwind.example, not-an-address to see both outcomes.
Paste a list separated by commas, semicolons or spaces.
import { useState } from 'react';import { Field, FieldDescription, FieldError, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectRefuseCause,} from '@slotted/react/multi-select';const TEAMS = [ { value: 'purchasing@northwind.example', description: 'Purchasing team' }, { value: 'warehouse-ops@northwind.example', description: 'Warehouse operations' }, { value: 'category-managers@northwind.example', description: 'Category managers' },];const isEmail = (text: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text.trim());const REASONS: Record<MultiSelectRefuseCause, string> = { invalid: 'is not an email address', duplicate: 'is already on the list', limit: 'is over the limit',};export default function MultiSelectEmailList() { const [refused, setRefused] = useState<string | null>(null); return ( <Field invalid={refused !== null ? true : undefined}> <FieldLabel>Stockout alerts</FieldLabel> <MultiSelect creatable delimiters={[',', ';', ' ']} defaultValue={['purchasing@northwind.example']} validateValue={isEmail} onValueRefuse={(values, { cause }) => setRefused(`${values.join(', ')} ${REASONS[cause]}.`)} onValueChange={() => setRefused(null)} > <MultiSelectControl placeholder="name@company.com" /> <MultiSelectContent> {TEAMS.map((team) => ( <MultiSelectItem key={team.value} value={team.value} description={team.description}> {team.value} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> {refused === null ? ( <FieldDescription>Paste a list separated by commas, semicolons or spaces.</FieldDescription> ) : ( <FieldError live="polite">{refused}</FieldError> )} </Field> );}Editing a value in place
With editable, Enter on a focused tag turns it into a text field holding its value. Enter commits the change as one update and Escape restores the original. ArrowLeft from the start of the input, or Backspace from an empty input, reaches the last tag.
Press ArrowLeft to reach a bin, then Enter to correct it in place.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl } from '@slotted/react/multi-select';export default function MultiSelectEditable() { return ( <Field> <FieldLabel>Bin locations</FieldLabel> <MultiSelect creatable editable defaultValue={['A-12-03', 'A-12-04', 'C-02-11']} messages={{ empty: 'Type a bin code and press Enter.' }} > <MultiSelectControl placeholder="Add a bin" /> <MultiSelectContent /> </MultiSelect> <FieldDescription> Press ArrowLeft to reach a bin, then Enter to correct it in place. </FieldDescription> </Field> );}Controlled
Pass value and update it from onValueChange when other parts of the screen depend on the set; in Angular, bind [(value)] to a signal. The value is an array in the reader’s order. The request carries the reason: select from the list, submit from typed text, remove for one tag, clear for all of them, and keyboard for a reorder. In Angular the reason arrives through (valueChangeRequest).
import { useState } from 'react';import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' },];const labelOf = (value: string) => WAREHOUSES.find((option) => option.value === value)?.label;export default function MultiSelectControlled() { const [warehouses, setWarehouses] = useState<readonly string[]>(['RNO', 'CMH']); const [reason, setReason] = useState<string | null>(null); return ( <Stack gap={3}> <Field> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect value={warehouses} items={WAREHOUSES} onValueChange={(next, request) => { setWarehouses(next); setReason(request.reason); }} > <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> <Text size="sm" tone="muted"> {warehouses.length === 0 ? 'Not stocked anywhere' : `Stocked at ${warehouses.map(labelOf).join('; ')}`} {reason === null ? '' : ` · last change: ${reason}`} </Text> </Stack> );}Clearing
The clear button appears while the control holds tags or typed text. It empties both under the reason clear and returns focus to the input. clearable={false} removes the button, so tags come off one at a time. Escape never clears the set: it closes the list, or empties the typed text when the list is closed.
The clear button empties the filter in one press.
No clear button: channels come off one at a time.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const CHANNELS: MultiSelectOption[] = [ { value: 'web', label: 'Web store' }, { value: 'marketplace', label: 'Marketplace' }, { value: 'wholesale', label: 'Wholesale' }, { value: 'phone', label: 'Phone orders' },];const options = CHANNELS.map((channel) => ( <MultiSelectItem key={channel.value} value={channel.value}> {channel.label} </MultiSelectItem>));export default function MultiSelectClearing() { return ( <Stack gap={5}> <Field> <FieldLabel>Show orders from</FieldLabel> <MultiSelect defaultValue={['web', 'marketplace', 'phone']} items={CHANNELS}> <MultiSelectControl placeholder="All channels" /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>The clear button empties the filter in one press.</FieldDescription> </Field> <Field> <FieldLabel>Sell through</FieldLabel> <MultiSelect clearable={false} defaultValue={['web', 'wholesale']} items={CHANNELS}> <MultiSelectControl /> <MultiSelectContent>{options}</MultiSelectContent> </MultiSelect> <FieldDescription>No clear button: channels come off one at a time.</FieldDescription> </Field> </Stack> );}Loading options
Set loading while options are on their way. The chevron becomes a spinner, the list shows three placeholder rows, and a status row announces the loading message. Here the options are requested the first time the list opens, from onOpenChange in React and (openChange) in Angular.
Carriers load from the rates service when the list opens.
import { useState } from 'react';import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const CARRIERS: MultiSelectOption[] = [ { value: 'ups', label: 'UPS Ground' }, { value: 'fedex', label: 'FedEx Ground' }, { value: 'usps', label: 'USPS Priority Mail' }, { value: 'dhl', label: 'DHL Express' },];/** Stands in for a request to the shipping rates API. */const fetchCarriers = () => new Promise<MultiSelectOption[]>((resolve) => setTimeout(() => resolve(CARRIERS), 1500));export default function MultiSelectLoading() { const [carriers, setCarriers] = useState<MultiSelectOption[]>([]); const [loading, setLoading] = useState(false); const [loaded, setLoaded] = useState(false); const load = async (open: boolean) => { if (!open || loaded || loading) return; setLoading(true); setCarriers(await fetchCarriers()); setLoading(false); setLoaded(true); }; return ( <Field> <FieldLabel>Carriers offered at checkout</FieldLabel> <MultiSelect loading={loading} items={carriers} messages={{ loading: 'Fetching carriers…' }} onOpenChange={(open) => void load(open)} > <MultiSelectControl placeholder="Add a carrier" /> <MultiSelectContent> {carriers.map((carrier) => ( <MultiSelectItem key={carrier.value} value={carrier.value}> {carrier.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription>Carriers load from the rates service when the list opens.</FieldDescription> </Field> );}Searching on the server
filter={null} turns the built-in filter off, for options a server has already filtered. Send the typed text to the server from onInputValueChange in React or (inputValueChange) in Angular, render what comes back, and set loading while the request runs. Tags keep their labels when a later search no longer returns their options. The empty message replaces “No matches” when nothing comes back.
Each keystroke searches the customer list on the server.
import { useEffect, useState } from 'react';import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem,} from '@slotted/react/multi-select';interface Customer { value: string; label: string; city: string;}const CUSTOMERS: Customer[] = [ { value: 'ALFKI', label: 'Alfreds Futterkiste', city: 'Berlin' }, { value: 'ANATR', label: 'Ana Trujillo Emparedados', city: 'México D.F.' }, { value: 'BERGS', label: 'Berglunds snabbköp', city: 'Luleå' }, { value: 'BLAUS', label: 'Blauer See Delikatessen', city: 'Mannheim' }, { value: 'BONAP', label: 'Bon app’', city: 'Marseille' }, { value: 'BOTTM', label: 'Bottom-Dollar Markets', city: 'Tsawassen' }, { value: 'ERNSH', label: 'Ernst Handel', city: 'Graz' }, { value: 'FOLKO', label: 'Folk och fä HB', city: 'Bräcke' }, { value: 'FRANK', label: 'Frankenversand', city: 'München' }, { value: 'QUICK', label: 'QUICK-Stop', city: 'Cunewalde' }, { value: 'RATTC', label: 'Rattlesnake Canyon Grocery', city: 'Albuquerque' }, { value: 'SAVEA', label: 'Save-a-lot Markets', city: 'Boise' },];/** Stands in for the customer search endpoint, which filters on the server. */const searchCustomers = (query: string) => new Promise<Customer[]>((resolve) => setTimeout(() => { const needle = query.trim().toLowerCase(); resolve(CUSTOMERS.filter((customer) => customer.label.toLowerCase().includes(needle))); }, 600), );/** The first page of customers, which arrives with the page itself. */const FIRST_PAGE = CUSTOMERS.slice(0, 6);export default function MultiSelectAsyncSearch() { const [query, setQuery] = useState(''); const [results, setResults] = useState<Customer[]>(FIRST_PAGE); const [loading, setLoading] = useState(false); useEffect(() => { if (query.trim() === '') { setResults(FIRST_PAGE); setLoading(false); return; } let current = true; setLoading(true); void searchCustomers(query).then((found) => { if (!current) return; setResults(found); setLoading(false); }); return () => { current = false; }; }, [query]); return ( <Field> <FieldLabel>Customers in this campaign</FieldLabel> <MultiSelect filter={null} loading={loading} messages={{ empty: 'No customer by that name.', loading: 'Searching customers…' }} onInputValueChange={setQuery} > <MultiSelectControl placeholder="Search customers" /> <MultiSelectContent> {results.map((customer) => ( <MultiSelectItem key={customer.value} value={customer.value} description={customer.city} > {customer.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription>Each keystroke searches the customer list on the server.</FieldDescription> </Field> );}Long lists
The list is never taller than the space the viewport leaves for it, and scrolls inside. PageDown and PageUp move the highlight ten options, and the list scrolls to the highlighted option without moving the page. chosenOptions="hide" takes chosen options out of the list, which suits a long list where the tags already show what was chosen.
Ground shipping from Reno, NV reaches these states in two days.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const STATES: MultiSelectOption[] = [ { value: 'AL', label: 'Alabama' }, { value: 'AK', label: 'Alaska' }, { value: 'AZ', label: 'Arizona' }, { value: 'AR', label: 'Arkansas' }, { value: 'CA', label: 'California' }, { value: 'CO', label: 'Colorado' }, { value: 'CT', label: 'Connecticut' }, { value: 'DE', label: 'Delaware' }, { value: 'FL', label: 'Florida' }, { value: 'GA', label: 'Georgia' }, { value: 'HI', label: 'Hawaii' }, { value: 'ID', label: 'Idaho' }, { value: 'IL', label: 'Illinois' }, { value: 'IN', label: 'Indiana' }, { value: 'IA', label: 'Iowa' }, { value: 'KS', label: 'Kansas' }, { value: 'KY', label: 'Kentucky' }, { value: 'LA', label: 'Louisiana' }, { value: 'ME', label: 'Maine' }, { value: 'MD', label: 'Maryland' }, { value: 'MA', label: 'Massachusetts' }, { value: 'MI', label: 'Michigan' }, { value: 'MN', label: 'Minnesota' }, { value: 'MS', label: 'Mississippi' }, { value: 'MO', label: 'Missouri' }, { value: 'MT', label: 'Montana' }, { value: 'NE', label: 'Nebraska' }, { value: 'NV', label: 'Nevada' }, { value: 'NH', label: 'New Hampshire' }, { value: 'NJ', label: 'New Jersey' }, { value: 'NM', label: 'New Mexico' }, { value: 'NY', label: 'New York' }, { value: 'NC', label: 'North Carolina' }, { value: 'ND', label: 'North Dakota' }, { value: 'OH', label: 'Ohio' }, { value: 'OK', label: 'Oklahoma' }, { value: 'OR', label: 'Oregon' }, { value: 'PA', label: 'Pennsylvania' }, { value: 'RI', label: 'Rhode Island' }, { value: 'SC', label: 'South Carolina' }, { value: 'SD', label: 'South Dakota' }, { value: 'TN', label: 'Tennessee' }, { value: 'TX', label: 'Texas' }, { value: 'UT', label: 'Utah' }, { value: 'VT', label: 'Vermont' }, { value: 'VA', label: 'Virginia' }, { value: 'WA', label: 'Washington' }, { value: 'WV', label: 'West Virginia' }, { value: 'WI', label: 'Wisconsin' }, { value: 'WY', label: 'Wyoming' },];export default function MultiSelectLongList() { return ( <Field> <FieldLabel>Ship-to states</FieldLabel> <MultiSelect chosenOptions="hide" defaultValue={['CA', 'NV', 'OR']} items={STATES}> <MultiSelectControl placeholder="Add a state" /> <MultiSelectContent> {STATES.map((state) => ( <MultiSelectItem key={state.value} value={state.value}> {state.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription> Ground shipping from Reno, NV reaches these states in two days. </FieldDescription> </Field> );}In a form
In React, name renders one hidden input per value under the same name, so FormData.getAll reads the set and a native reset restores defaultValue. In Angular, the multi-select is a form control: formControlName, formControl and ngModel bind the array, and its own validator reports required, tooMany past max and duplicate, with no validator to write. Submit without a warehouse to see the error, then reset.
import { useState } from 'react';import type { SubmitEvent } from 'react';import { Button } from '@slotted/react/button';import { Field, FieldError, FieldLabel } from '@slotted/react/field';import { Inline } from '@slotted/react/inline';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';import { Text } from '@slotted/react/typography';const WAREHOUSES: MultiSelectOption[] = [ { value: 'RNO', label: 'Reno, NV' }, { value: 'CMH', label: 'Columbus, OH' }, { value: 'SAV', label: 'Savannah, GA' }, { value: 'DFW', label: 'Dallas, TX' },];const CHANNELS: MultiSelectOption[] = [ { value: 'web', label: 'Web store' }, { value: 'marketplace', label: 'Marketplace' }, { value: 'wholesale', label: 'Wholesale' },];export default function MultiSelectForm() { const [missing, setMissing] = useState(false); const [saved, setSaved] = useState<string | null>(null); const submit = (event: SubmitEvent<HTMLFormElement>) => { event.preventDefault(); const data = new FormData(event.currentTarget); const warehouses = data.getAll('warehouses'); setMissing(warehouses.length === 0); setSaved( warehouses.length === 0 ? null : `Saved with ${warehouses.length} of ${WAREHOUSES.length} warehouses.`, ); }; const reset = () => { setMissing(false); setSaved(null); }; return ( <form noValidate onSubmit={submit} onReset={reset}> <Stack gap={5}> <Field required invalid={missing ? true : undefined}> <FieldLabel>Stocking warehouses</FieldLabel> <MultiSelect name="warehouses" items={WAREHOUSES} onValueChange={() => setMissing(false)}> <MultiSelectControl placeholder="Add a warehouse" /> <MultiSelectContent> {WAREHOUSES.map((warehouse) => ( <MultiSelectItem key={warehouse.value} value={warehouse.value}> {warehouse.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldError live="polite" reserve> {missing ? 'Choose at least one warehouse to stock this product.' : ''} </FieldError> </Field> <Field> <FieldLabel>Sales channels</FieldLabel> <MultiSelect name="channels" defaultValue={['web']} items={CHANNELS}> <MultiSelectControl /> <MultiSelectContent> {CHANNELS.map((channel) => ( <MultiSelectItem key={channel.value} value={channel.value}> {channel.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> <Inline gap={3} align="center"> <Button type="submit">Save</Button> <Button type="reset" tone="secondary" variant="outline"> Reset </Button> {saved && ( <Text size="sm" tone="muted"> {saved} </Text> )} </Inline> </Stack> </form> );}Narrow controls
Under 120 pixels there is no room for a tag, and the control shows a count such as 3 chosen instead; the count ends in an ellipsis when the clear button and the chevron leave too little room for it, and the grid still announces it whole. width="content" lets the list grow past a narrow control, so labels keep their length.
import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const CHANNELS: MultiSelectOption[] = [ { value: 'web', label: 'Web store' }, { value: 'marketplace', label: 'Marketplace' }, { value: 'wholesale', label: 'Wholesale' }, { value: 'phone', label: 'Phone orders' },];export default function MultiSelectNarrow() { return ( <Stack gap={4} style={{ inlineSize: '7rem' }}> <Field> <FieldLabel>Channels</FieldLabel> <MultiSelect size="sm" width="content" defaultValue={['web', 'marketplace', 'wholesale']} items={CHANNELS} > <MultiSelectControl /> <MultiSelectContent> {CHANNELS.map((channel) => ( <MultiSelectItem key={channel.value} value={channel.value}> {channel.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> </Stack> );}Keyboard and reordering
The multi-select is one tab stop. ArrowLeft from the start of the input reaches the last tag; from there ArrowLeft and ArrowRight walk the tags, Delete removes the focused tag, and any character returns to the input and types there. Backspace from an empty input first moves to the last tag and removes nothing; a second press removes it. With reorderable, Alt with ArrowLeft or ArrowRight moves the focused tag one place and Alt with Home or End moves it to either end; the move is reported with the reason keyboard and announced with the new position.
Rates are requested from the first carrier, then the next. Alt with an arrow moves the focused carrier.
import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';const CARRIERS: MultiSelectOption[] = [ { value: 'ups', label: 'UPS Ground' }, { value: 'fedex', label: 'FedEx Ground' }, { value: 'usps', label: 'USPS Priority Mail' }, { value: 'dhl', label: 'DHL Express' }, { value: 'ontrac', label: 'OnTrac' },];export default function MultiSelectKeyboard() { return ( <Field> <FieldLabel>Carrier priority</FieldLabel> <MultiSelect reorderable defaultValue={['usps', 'ups', 'fedex']} items={CARRIERS}> <MultiSelectControl placeholder="Add a carrier" /> <MultiSelectContent> {CARRIERS.map((carrier) => ( <MultiSelectItem key={carrier.value} value={carrier.value}> {carrier.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription> Rates are requested from the first carrier, then the next. Alt with an arrow moves the focused carrier. </FieldDescription> </Field> );}Defaults for a section
MultiSelectDefaultsProvider in React and provideMultiSelectDefaults in Angular set any axis once for every multi-select under them, such as size, variant and overflow for a filter panel. A value set on one multi-select still wins.
import { Field, FieldLabel } from '@slotted/react/field';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectDefaultsProvider, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';const OWNERS: MultiSelectOption[] = [ { value: 'avery', label: 'Avery Collins' }, { value: 'kenji', label: 'Kenji Watanabe' }, { value: 'lucia', label: 'Lucía Fernández' }, { value: 'omar', label: 'Omar Haddad' },];const SEGMENTS: MultiSelectOption[] = [ { value: 'enterprise', label: 'Enterprise' }, { value: 'wholesale', label: 'Wholesale' }, { value: 'retail', label: 'Retail' },];export default function MultiSelectDefaults() { return ( <MultiSelectDefaultsProvider size="sm" variant="subtle" overflow="collapse"> <Stack gap={4}> <Field> <FieldLabel>Account owners</FieldLabel> <MultiSelect defaultValue={['lucia', 'kenji']} items={OWNERS}> <MultiSelectControl placeholder="Any owner" /> <MultiSelectContent> {OWNERS.map((owner) => ( <MultiSelectItem key={owner.value} value={owner.value}> {owner.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> <Field> <FieldLabel>Segments</FieldLabel> <MultiSelect defaultValue={['wholesale']} items={SEGMENTS}> <MultiSelectControl placeholder="Any segment" /> <MultiSelectContent> {SEGMENTS.map((segment) => ( <MultiSelectItem key={segment.value} value={segment.value}> {segment.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Field> </Stack> </MultiSelectDefaultsProvider> );}Filters above a table
Two compact multi-selects filter the rows of an orders table. overflow="collapse" keeps each filter one row high, each option’s description shows how many orders it matches, and an empty filter means every value. Outside a field, aria-label names each control.
| Order | Customer | Status | Channel | Total |
|---|---|---|---|---|
| SO-10482 | Harbor & Pine | Open | Web store | $1,240.00 |
| SO-10485 | Verde Kitchen | Delayed | Web store | $86.00 |
| SO-10487 | Atlas Freight | Open | Wholesale | $1,912.00 |
| SO-10488 | Lumen Dental | Open | Web store | $472.80 |
| SO-10489 | Cobalt Outfitters | Delayed | Marketplace | $1,055.40 |
import { useState } from 'react';import { Grid } from '@slotted/react/grid';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';import { Text } from '@slotted/react/typography';const ORDERS = [ { id: 'SO-10482', customer: 'Harbor & Pine', status: 'open', channel: 'web', total: '$1,240.00' }, { id: 'SO-10483', customer: 'Brightline Studio', status: 'on-hold', channel: 'phone', total: '$318.50', }, { id: 'SO-10484', customer: 'Northgate Labs', status: 'shipped', channel: 'wholesale', total: '$2,906.10', }, { id: 'SO-10485', customer: 'Verde Kitchen', status: 'delayed', channel: 'web', total: '$86.00' }, { id: 'SO-10486', customer: 'Quill & Co.', status: 'shipped', channel: 'marketplace', total: '$540.25', }, { id: 'SO-10487', customer: 'Atlas Freight', status: 'open', channel: 'wholesale', total: '$1,912.00', }, { id: 'SO-10488', customer: 'Lumen Dental', status: 'open', channel: 'web', total: '$472.80' }, { id: 'SO-10489', customer: 'Cobalt Outfitters', status: 'delayed', channel: 'marketplace', total: '$1,055.40', },];const STATUSES: MultiSelectOption[] = [ { value: 'open', label: 'Open' }, { value: 'on-hold', label: 'On hold' }, { value: 'delayed', label: 'Delayed' }, { value: 'shipped', label: 'Shipped' },];const CHANNELS: MultiSelectOption[] = [ { value: 'web', label: 'Web store' }, { value: 'marketplace', label: 'Marketplace' }, { value: 'wholesale', label: 'Wholesale' }, { value: 'phone', label: 'Phone orders' },];type Facet = 'status' | 'channel';const labelOf = (options: MultiSelectOption[], value: string) => options.find((option) => option.value === value)?.label;const countOf = (facet: Facet, value: string) => { const count = ORDERS.filter((order) => order[facet] === value).length; return count === 1 ? '1 order' : `${count} orders`;};export default function MultiSelectFilterBar() { const [statuses, setStatuses] = useState<readonly string[]>(['open', 'delayed']); const [channels, setChannels] = useState<readonly string[]>([]); const rows = ORDERS.filter( (order) => (statuses.length === 0 || statuses.includes(order.status)) && (channels.length === 0 || channels.includes(order.channel)), ); return ( <Stack gap={3}> <Grid columns={2} gap={3}> <MultiSelect size="sm" overflow="collapse" value={statuses} items={STATUSES} onValueChange={setStatuses} > <MultiSelectControl aria-label="Status" placeholder="All statuses" /> <MultiSelectContent aria-label="Status"> {STATUSES.map((status) => ( <MultiSelectItem key={status.value} value={status.value} description={countOf('status', status.value)} > {status.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <MultiSelect size="sm" overflow="collapse" value={channels} items={CHANNELS} onValueChange={setChannels} > <MultiSelectControl aria-label="Channel" placeholder="All channels" /> <MultiSelectContent aria-label="Channel"> {CHANNELS.map((channel) => ( <MultiSelectItem key={channel.value} value={channel.value} description={countOf('channel', channel.value)} > {channel.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </Grid> <Text size="sm" tone="muted"> {rows.length} of {ORDERS.length} orders </Text> <Table columns={5}> <TableContent aria-label="Orders"> <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Status</TableColumnHeader> <TableColumnHeader>Channel</TableColumnHeader> <TableColumnHeader numeric>Total</TableColumnHeader> </TableRow> </TableHead> <TableBody> {rows.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader>{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell>{labelOf(STATUSES, order.status)}</TableCell> <TableCell>{labelOf(CHANNELS, order.channel)}</TableCell> <TableCell numeric>{order.total}</TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> </Stack> );}Tagging orders in a table
A plain, compact, creatable multi-select in each row holds that order’s tags. variant="plain" draws no frame inside the cell, overflow="collapse" keeps the row one line high, and a new tag is typed and committed in place.
| Order | Customer | Tags |
|---|---|---|
| SO-10482 | Harbor & Pine | priorityfragile+1 |
| SO-10483 | Brightline Studio | address check+1 |
| SO-10484 | Northgate Labs | wholesalebackorderpriority+1 |
| SO-10485 | Verde Kitchen | +1 |
import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow, TableRowHeader,} from '@slotted/react/table';const TAGS: MultiSelectOption[] = [ { value: 'priority', label: 'priority' }, { value: 'gift wrap', label: 'gift wrap' }, { value: 'fragile', label: 'fragile' }, { value: 'backorder', label: 'backorder' }, { value: 'address check', label: 'address check' }, { value: 'wholesale', label: 'wholesale' },];const ORDERS = [ { id: 'SO-10482', customer: 'Harbor & Pine', tags: ['priority', 'fragile'] }, { id: 'SO-10483', customer: 'Brightline Studio', tags: ['address check'] }, { id: 'SO-10484', customer: 'Northgate Labs', tags: ['wholesale', 'backorder', 'priority'] }, { id: 'SO-10485', customer: 'Verde Kitchen', tags: [] },];export default function MultiSelectOrderTags() { return ( <Table columns={3}> <TableContent aria-label="Orders"> <TableHead> <TableRow> <TableColumnHeader>Order</TableColumnHeader> <TableColumnHeader>Customer</TableColumnHeader> <TableColumnHeader>Tags</TableColumnHeader> </TableRow> </TableHead> <TableBody> {ORDERS.map((order) => ( <TableRow key={order.id} value={order.id}> <TableRowHeader>{order.id}</TableRowHeader> <TableCell>{order.customer}</TableCell> <TableCell> <MultiSelect variant="plain" size="sm" overflow="collapse" creatable defaultValue={order.tags} items={TAGS} > <MultiSelectControl aria-label={`Tags for ${order.id}`} placeholder="Add a tag" /> <MultiSelectContent aria-label={`Tags for ${order.id}`}> {TAGS.map((tag) => ( <MultiSelectItem key={tag.value} value={tag.value}> {tag.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> </TableCell> </TableRow> ))} </TableBody> </TableContent> </Table> );}Choosing table columns
A reorderable multi-select decides which columns the table shows and in which order. “Show all” sets the whole list as the value, which is how a select-all is composed: the multi-select has no built-in one, because only the page knows what “all” means under a filter or a limit.
The table follows the order of the chips. Alt with an arrow moves a focused column.
| Order | Customer | Total |
|---|---|---|
| SO-10482 | Harbor & Pine | $1,240.00 |
| SO-10483 | Brightline Studio | $318.50 |
| SO-10484 | Northgate Labs | $2,906.10 |
import { useState } from 'react';import { Button } from '@slotted/react/button';import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';import { Inline } from '@slotted/react/inline';import { MultiSelect, MultiSelectContent, MultiSelectControl, MultiSelectItem, type MultiSelectOption,} from '@slotted/react/multi-select';import { Stack } from '@slotted/react/stack';import { Table, TableBody, TableCell, TableColumnHeader, TableContent, TableHead, TableRow,} from '@slotted/react/table';type Column = 'order' | 'customer' | 'placed' | 'items' | 'total';const COLUMNS: (MultiSelectOption & { value: Column })[] = [ { value: 'order', label: 'Order' }, { value: 'customer', label: 'Customer' }, { value: 'placed', label: 'Placed' }, { value: 'items', label: 'Items' }, { value: 'total', label: 'Total' },];const ORDERS: Record<Column, string>[] = [ { order: 'SO-10482', customer: 'Harbor & Pine', placed: 'Oct 2', items: '14', total: '$1,240.00', }, { order: 'SO-10483', customer: 'Brightline Studio', placed: 'Oct 3', items: '3', total: '$318.50', }, { order: 'SO-10484', customer: 'Northgate Labs', placed: 'Oct 3', items: '41', total: '$2,906.10', },];const ALL = COLUMNS.map((column) => column.value);const labelOf = (value: string) => COLUMNS.find((column) => column.value === value)?.label;export default function MultiSelectChooseColumns() { const [shown, setShown] = useState<readonly string[]>(['order', 'customer', 'total']); const columns = shown as readonly Column[]; return ( <Stack gap={4}> <Field> <Inline gap={3} justify="between" align="center"> <FieldLabel>Columns</FieldLabel> <Button size="sm" tone="secondary" variant="ghost" disabled={shown.length === ALL.length} onClick={() => setShown(ALL)} > Show all </Button> </Inline> <MultiSelect reorderable value={shown} items={COLUMNS} onValueChange={setShown}> <MultiSelectControl placeholder="Add a column" /> <MultiSelectContent> {COLUMNS.map((column) => ( <MultiSelectItem key={column.value} value={column.value}> {column.label} </MultiSelectItem> ))} </MultiSelectContent> </MultiSelect> <FieldDescription> The table follows the order of the chips. Alt with an arrow moves a focused column. </FieldDescription> </Field> <Table columns={Math.max(columns.length, 1)}> <TableContent aria-label="Orders"> <TableHead> <TableRow> {columns.map((column) => ( <TableColumnHeader key={column}>{labelOf(column)}</TableColumnHeader> ))} </TableRow> </TableHead> <TableBody> {ORDERS.map((order) => ( <TableRow key={order.order} value={order.order}> {columns.map((column) => ( <TableCell key={column}>{order[column]}</TableCell> ))} </TableRow> ))} </TableBody> </TableContent> </Table> </Stack> );}Accessibility
| Key | Effect | Focus |
|---|---|---|
| ArrowDown | closed, opens and highlights the first option; open, moves the highlight to the next option, wrapping only when loop is true | stays on the input, and the caret does not move |
| ArrowUp | closed, opens and highlights the last option, which is the pattern's optional Up Arrow; open, moves the highlight to the previous option | the input, caret unmoved |
| Alt+ArrowDown | opens the popup without moving the highlight | the input |
| Alt+ArrowUp | closes the popup | the input |
| Enter | with a highlight, toggles that option, empties the query and leaves the popup open; with no highlight, an offer drawn and creatable set, commits the typed text as a value; on a chip with editable set, opens or commits the chip's field | the input, or the chip's cell while it is being edited |
| Escape | open, closes and keeps the typed text; closed, clears the typed text; on a chip, returns to the input; while a chip is being edited, reverts it. It never clears the selection | the input |
| Home | on the input, the browser's caret movement, never intercepted, which is the pattern's editable branch; on a chip, moves to the first cell | the input with the caret at the first character, or the first chip |
| End | on the input, the browser's caret movement, never intercepted; on a chip, moves to the last cell, which is the input | the input with the caret after the last character |
| PageDown | moves the highlight ten options down, which is PAGE_STEP from the collection engine | the input |
| PageUp | moves the highlight ten options up | the input |
| ArrowLeft | on the input, the browser's caret movement while the caret has anywhere to go; from the start of the query it moves to the previous cell, which under dir=rtl is the next one. On a chip, moves one cell | the input or a chip's cell |
| ArrowRight | on the input, the browser's caret movement while the caret has anywhere to go; from the end of the query it moves to the next cell, which under dir=rtl is the previous one. On a chip, moves one cell | the input or a chip's cell |
| Alt+ArrowLeft | with reorderable set, moves the focused value one place toward the start of the row, and toward the end under dir=rtl | stays on the moved chip, which has changed cell |
| Alt+ArrowRight | with reorderable set, moves the focused value one place toward the end of the row, and toward the start under dir=rtl | stays on the moved chip |
| Alt+Home | with reorderable set, moves the focused value to the start of the row | stays on the moved chip |
| Alt+End | with reorderable set, moves the focused value to the end of the row | stays on the moved chip |
| Backspace | on the input with a query, the browser's own deletion; on the input with an empty query and the caret at the start, the first press moves focus to the last chip and removes nothing and the second press removes it; on a chip, removes that value | the last chip, then the chip that took the removed one's index, then the previous chip, then the input |
| Delete | on a chip, removes that value; on the input, the browser's own deletion | the chip that took the removed one's index, then the previous chip, then the input |
| Delimiter | any character in the delimiters axis commits the typed text as a value and is never typed into the input | the input |
| Printable character | on the input, types and filters; on a chip, returns focus to the input and types it there, which is the grid pattern's alphanumeric branch | the input |
| Tab | leaves the control. With commitOnBlur set, the pending text is committed first. The popup, the chips and the remove buttons are outside the tab sequence, which the combobox pattern requires of a popup and the grid pattern of a layout grid | the element beside the control in the document's order |
- The input is the tab stop of the control. The tags, their remove buttons and the trigger carry tabindex="-1", as the combobox and grid patterns ask; the clear button, while it is drawn, is in the tab order.
- The tags are a layout grid with one row, which leaves ArrowDown and ArrowUp to the list. Focus lands on a tag rather than on its remove button, and Delete and Backspace do what the button does. The grid carries the number of chosen values as its name.
- The list sets aria-multiselectable, and selection does not follow the highlight: moving through the options chooses nothing until Enter or a press. This departs from the note in the combobox pattern, as every implementation surveyed does.
- Changes are announced as well as drawn: a value added with the count now held, a value removed with its label and the count left, a value moved with its new position, and the limit when it is reached. The status row announces how many options match the query.
API
multi-select
Props
valuereadonly string[]- The chosen values, in the order the reader chose them. Controlled.
defaultValuereadonly string[]- The values an uncontrolled multi-select starts with, read once. A reset of the form it belongs to returns to them.
inputValuestring- The text in the input. It is emptied whenever a value is committed. Controlled.
defaultInputValuestring- The text an uncontrolled input starts with, read once.
openboolean- Whether the list is open. Controlled.
defaultOpenboolean- Whether an uncontrolled list starts open.
highlightedValuestring | null- The option the highlight is on, which is not a chosen option. Controlled.
defaultHighlightedValuestring | null- Where an uncontrolled highlight starts.
itemsMultiSelectItems- Values and labels declared up front, so a tag shows its label before the list has rendered its options.
filterMultiSelectFilter- Compares an option label with the query. When absent, the comparison is a locale-sensitive "contains" that ignores case and accents; null turns filtering off for options a server has already filtered.
localestring- The BCP 47 language of the filter and of the duplicate comparison. When absent, the language in force.
validateValue(text, values) => boolean- Whether typed text may become a value. Text it turns down is reported through onValueRefuse with the cause invalid.
namestring- The submission name. One hidden input per value carries it.
formstring- The id of the form the hidden inputs belong to, for a multi-select rendered outside it.
totalnumber- The number of options in the whole collection, for aria-setsize on a windowed list.
maxnumber | nullDefaultnull- The most values the set may hold; null means no limit. At the limit, every option not yet chosen is announced as unavailable.
delimitersreadonly string[]Default,- The characters that commit the typed text and split a paste. One list serves both.
creatablebooleanDefaultfalse- Whether typed text may become a value.
editablebooleanDefaultfalse- Whether Enter on a focused tag turns it into a text field.
reorderablebooleanDefaultfalse- Whether Alt with ArrowLeft, ArrowRight, Home or End moves the focused tag along the row.
allowDuplicatesbooleanDefaultfalse- Whether the same value may be held twice.
addOnPastebooleanDefaulttrue- Whether a paste that contains delimiters becomes several values.
commitOnBlurbooleanDefaulttrue- Whether typed text is committed when focus leaves the control.
overflow'wrap' | 'collapse'Defaultwrap- What the control does with more tags than fit: wrap grows by rows up to three, then scrolls; collapse keeps one row and counts the rest in a +N tag.
chosenOptions'show' | 'hide'Defaultshow- Whether a chosen option stays in the list with a check, or leaves it.
clearablebooleanDefaulttrue- Whether the clear button is drawn while the control holds a value or typed text.
closeOnSelectbooleanDefaultfalse- Whether choosing an option closes the list. Off by default, because a set is built with several choices.
closeOnEscapebooleanDefaulttrue- Whether Escape closes the list.
closeOnOutsidePressbooleanDefaulttrue- Whether a press outside the list closes it.
loopbooleanDefaultfalse- Whether the highlight wraps from the last option to the first, and back.
highlightMatchbooleanDefaulttrue- Whether the span the query matched is marked.
size'sm' | 'md' | 'lg'Defaultmd- The step of the control scale. Inside a field, an unset size follows the field.
variant'outline' | 'subtle' | 'plain'Defaultoutline- The frame: outline draws an edge, subtle a filled ground, plain neither until hover or focus.
side'bottom' | 'top' | 'inline-start' | 'inline-end' | 'left' | 'right'Defaultbottom- The side of the control the list opens on.
align'start' | 'center' | 'end'Defaultstart- How the list aligns along that side.
width'anchor' | 'content'Defaultcontent- content keeps the list at least as wide as the control and widens it to its longest option; anchor pins it to the width of the control.
mount'active' | 'lazy' | 'eager'Defaultactive- When the list exists in the DOM: only while open (active), from the first open on (lazy), or from the start (eager).
strategy'absolute' | 'fixed'Defaultabsolute- The CSS position the list uses.
openOn'input' | 'focus' | 'manual'Defaultinput- Which gestures open the list besides the trigger and the arrow keys: typing or a press on the input (input), also any focus on the input (focus), or none, so typing filters without opening (manual).
sideOffsetnumberDefault4- The distance in pixels between the control and the list.
alignOffsetnumberDefault0- The shift in pixels along the aligned edge.
collisionPaddingnumberDefault8- How close in pixels the list may come to the edge of the viewport before it moves.
flipbooleanDefaulttrue- Whether the list moves to the opposite side when it does not fit.
shiftbooleanDefaulttrue- Whether the list slides along its side to stay in view.
hideWhenDetachedbooleanDefaulttrue- Whether the list hides when the control scrolls out of its clipping container.
portalbooleanDefaulttrue- Whether the list is portalled to the end of the document.
fullWidthbooleanDefaulttrue- Whether the control fills the width of its container.
disabledbooleanDefaultfalse- Whether the control is disabled: it takes no input, draws no remove buttons and leaves the tab order.
readOnlybooleanDefaultfalse- Whether the values can be read and copied but not changed. The input stays focusable; the list, the remove buttons and the clear button are withheld.
requiredbooleanDefaultfalse- Whether an empty set is invalid.
invalidbooleanDefaultfalse- Whether the control is drawn in the error state, with aria-invalid on the input.
loadingbooleanDefaultfalse- Whether options are on their way: the spinner replaces the chevron and the list shows placeholder rows.
messagesPartial<MultiSelectMessages>- Replaces any of the phrases the multi-select writes: clear, trigger, chosen ({count}), count ({count}), counter ({count}, {max}), create ({query}), empty, loading, remove ({label}) and reorder ({label}, {position}, {count}). Phrases left out come from the language in force.
render(props) => ReactNode- On MultiSelectControlReplaces the frame element. The props it receives include the ref that measures the frame for the narrow layout, which the replacement has to keep.
chosenbooleanDefaulttrue- On MultiSelectContentWhether the band of chosen values is drawn at the top of the list.
emptyReactNode- On MultiSelectContentWhat the list shows when no option matches, in place of the empty message.
statusReactNode- On MultiSelectContentWhat the live region says, in place of the number of matching options.
valuestring- On MultiSelectItemThe key of the option, which is what enters the set.
disabledbooleanDefaultfalse- On MultiSelectItemWhether the option can be chosen.
descriptionReactNode- On MultiSelectItemA second line under the label.
iconReactNode- On MultiSelectItemAny element, drawn in the first column of the option.
textValuestring- On MultiSelectItemThe text the filter compares, for an option whose children are not plain text.
positionnumber- On MultiSelectItemThe place of the option in a windowed collection, for aria-posinset.
labelReactNode- On MultiSelectGroupThe name of the group.
Events
| Name | Payload | When |
|---|---|---|
onValueChange | (value: readonly string[], request: ChangeRequest<readonly string[]>) | Before the set changes. request.reason is select for an option, submit for typed text, remove for one value, clear for all of them, keyboard for a reorder, and programmatic for the handle and for a form reset. request.cancel() refuses the change. |
onValueRefuse | (values: readonly string[], details: { cause: "duplicate" | "limit" | "invalid" }) | Values were turned away, and details.cause says why. Nothing is held and nothing can be cancelled: the values never entered the set. |
onInputValueChange | (value: string, request: ChangeRequest<string>) | Before the typed text changes. request.reason is keyboard while typing, select or submit when a commit empties it, clear for Escape or the clear button, blur when leaving the control commits it, and programmatic for a form reset. |
onOpenChange | (open: boolean, request: ChangeRequest<boolean>) | Before the list opens or closes. request.reason is pointer, keyboard, escape, outsidePress, select, dismiss, blur or programmatic. |
onHighlightedValueChange | (value: string | null, request: ChangeRequest<string | null>) | Before the highlight moves. request.reason is pointer, keyboard or programmatic. Moving the highlight chooses nothing. |
onLoadMore | () | The last option scrolled into view, so the next page can be fetched. |
Composition
MultiSelectDefaultsProvidercomponent- On ApplicationSets any axis once for every multi-select below it. The words come from the language in force, set by SlottedProvider. A prop set on one multi-select still wins.
render(props) => ReactNode- On MultiSelectControl, MultiSelectContentOn MultiSelectControl, replaces the frame and receives the ref that measures it; a replacement that drops the ref loses the narrow layout. On MultiSelectContent, replaces the layer and receives its attributes and the options.
refRef<MultiSelectHandle>- focus(), open(), close(), scrollToKey(value) and setValue(values, reason): the actions a prop cannot express.
native propsComponentPropsWithRef- On MultiSelectControl, MultiSelectContentProps written on MultiSelectControl reach the input, such as aria-label and placeholder; props written on MultiSelectContent reach the listbox. On the input, your onKeyDown, onChange, onClick, onFocus, onBlur and onPaste run first, and calling preventDefault stops the multi-select from handling that event.
data-*attributes- On every partEvery state is an attribute to style: data-open, data-disabled, data-readonly, data-invalid, data-required, data-loading, data-selected, data-current and data-complete.
Parts
| Part | Element | Required | Purpose |
|---|---|---|---|
root | div, rendered by MultiSelectControl | Yes | The frame, carrying data-ui="multi-select". It draws the border, the shadow, the focus ring and every state. Its height is not fixed: it grows by whole rows of tags up to three, then scrolls. |
control | div with role="grid" | Yes | The layout grid that holds the tags and the field, as the APG grid pattern describes for a list of message recipients. Its aria-label carries the number of chosen values, such as "2 chosen". |
chips | div with role="row" | Yes | One row in the DOM, however many lines it wraps to. The wrap is CSS, so the reading order stays linear and ArrowDown and ArrowUp stay with the list. Past three rows it scrolls, and it draws no scrollbar inside the frame. |
field | span with role="gridcell" | Yes | The last cell of the row, holding the input. It wraps with the tags instead of moving to a line of its own, and it takes the width of a word with a floor of two characters. |
input | input with role="combobox" | Yes | A native text input, so text editing, the caret, selection, IME and autofill work as in any input. It is the tab stop of the control and carries aria-expanded, aria-controls and aria-activedescendant. |
counter | span | No | The number of values against max, such as "2 of 3", or the number chosen while the frame is too narrow for a tag. It is drawn only in those two cases. |
busy | span | No | The spinner that stands in place of the chevron while loading is set, because the list has nothing to open onto yet. |
clear | button | No | Removes every value and the typed text at once, under the reason clear. It is drawn while clearable is set and the control holds a value or typed text. |
trigger | button | Yes | Opens and closes the list with the pointer. It carries tabindex="-1", because the combobox pattern keeps the popup indicator out of the tab sequence. |
arrow | span | Yes | The chevron inside the trigger, a Glyph inside an Icon box, turned over while the list is open. |
positioner | div, rendered by MultiSelectContent | Yes | The layer, portalled to the end of the document. It carries data-ui="multi-select" as well, so the stylesheet reaches the list outside the root. |
content | div with role="listbox" and aria-multiselectable | Yes | The list surface. Selection does not follow the highlight: moving through the options chooses nothing, which departs from the combobox pattern on purpose. |
chosen | div | No | Every chosen value as a tag, at the top of the list, whatever the row in the control shows. With overflow="collapse", the values the +N tag counts stay readable here. |
group | div with role="group" | No | A run of options under a name. A group whose options were all filtered away is hidden with its heading, so a heading never claims a match. |
group-label | div | No | The name of a group, which the group references with aria-labelledby. |
item | div with role="option" | Yes | One option. It compares its own label with the query and is hidden when it does not match. Pressing an option already chosen removes its value. |
indicator | span | Yes | The check on a chosen option, and the plus on the option that adds the typed text. |
icon | span | No | The first column of an option, for an icon that makes rows recognizable. |
label | span | Yes | The text the reader chooses by, clamped to two lines. Its rules apply inside the option only, so the label of a tag keeps its own. |
match | mark, the match part of the highlight component, inside label | No | The span of the label the query matched, drawn by the highlight stylesheet, so every filtered list marks a match the same way. |
description | span | No | A second line under the label of an option, for detail the label has no room for. |
separator | div with role="separator" | No | A line between two runs of options. |
empty | div | No | The message shown when no option matches. It keeps the width of the list, so nothing shifts when results arrive. |
status | div with role="status" | Yes | The live region, and the loading row. It announces how many options match the query. |
placeholder | div holding skeleton rows | No | Rows the height of an option, standing in for the options while they load. Hidden from assistive technology, because the status row announces the wait. |
Theming
Each token is a CSS custom property: set it in a theme, or on any element to retune every multi-select inside it.
Multi-select tokens
| Token | Default |
|---|---|
--slotted-multi-select-action-active-background | var(--slotted-tone-secondary-subtle-active) |
--slotted-multi-select-action-color | var(--slotted-text-muted, GrayText) |
--slotted-multi-select-action-hover-background | var(--slotted-tone-secondary-subtle-hover) |
--slotted-multi-select-action-size | min(calc(var(--_icon-size) + 2 * var(--slotted-space-2, 0.25rem)), var(--_inner-size)) |
--slotted-multi-select-arrow-color | var(--slotted-text-muted, GrayText) |
--slotted-multi-select-autofill-background | var(--slotted-tone-accent-surface) |
--slotted-multi-select-background | var(--slotted-control-surface, Field) |
--slotted-multi-select-border-color | var(--slotted-control-border-color, ButtonBorder) |
--slotted-multi-select-color | var(--slotted-text, CanvasText) |
--slotted-multi-select-content-border-color | var(--slotted-border-subtle, #e2e8f0) |
--slotted-multi-select-content-padding-block | var(--slotted-space-2, 0.25rem) |
--slotted-multi-select-content-padding-inline | var(--slotted-space-2, 0.25rem) |
--slotted-multi-select-content-radius | var(--slotted-radius-lg, 8px) |
--slotted-multi-select-content-shadow | var(--slotted-shadow-md) |
--slotted-multi-select-content-text | var(--slotted-text, #0f172a) |
--slotted-multi-select-content-text-muted | var(--slotted-text-muted, #5b6b7f) |
--slotted-multi-select-counter-color | var(--slotted-text-muted, GrayText) |
--slotted-multi-select-counter-complete-color | var(--slotted-tone-accent-text) |
--slotted-multi-select-disabled-background | var(--slotted-disabled-background) |
--slotted-multi-select-disabled-border-color | var(--slotted-disabled-border) |
--slotted-multi-select-disabled-color | var(--slotted-disabled-foreground) |
--slotted-multi-select-field-basis | 4rem |
--slotted-multi-select-field-min | 2.5rem |
--slotted-multi-select-group-label-height | calc( var(--_secondary-font-size) * var(--slotted-line-height-sm, 1.45) + 2 * var(--slotted-space-2, 0.25rem) ) |
--slotted-multi-select-highlight | var(--slotted-tone-secondary-subtle-active) |
--slotted-multi-select-highlight-active | var(--slotted-tone-accent-surface) |
--slotted-multi-select-highlight-ring | var(--slotted-tone-accent-border) |
--slotted-multi-select-hover-border-color | var(--slotted-tone-accent-border) |
--slotted-multi-select-icon-size-min | 14px |
--slotted-multi-select-invalid-border-color | var(--slotted-tone-danger-border) |
--slotted-multi-select-invalid-edge-width | var(--slotted-control-invalid-edge-width, 1px) |
--slotted-multi-select-invalid-focus-ring-color | var(--slotted-focus-ring-color-invalid, Highlight) |
--slotted-multi-select-item-radius | max(0px, calc(var(--_radius) - var(--_inset-inline))) |
--slotted-multi-select-measure | 24rem |
--slotted-multi-select-open-border-color | var(--slotted-tone-accent-border) |
--slotted-multi-select-placeholder-color | var(--slotted-text-muted, GrayText) |
--slotted-multi-select-plain-hover-background | var(--slotted-tone-secondary-subtle-hover) |
--slotted-multi-select-radius | var(--slotted-control-radius, 4px) |
--slotted-multi-select-readonly-background | var(--slotted-tone-secondary-subtle-hover) |
--slotted-multi-select-selected-color | var(--slotted-tone-accent-text) |
--slotted-multi-select-separator-color | var(--_border-color) |
--slotted-multi-select-shadow | var(--slotted-control-shadow, none) |
--slotted-multi-select-subtle-background | var(--slotted-surface-sunken, Canvas) |
--slotted-multi-select-subtle-border-color | var(--slotted-border-subtle, ButtonBorder) |
--slotted-multi-select-subtle-hover-background | var(--slotted-tone-secondary-subtle-hover) |
--slotted-multi-select-surface | var(--slotted-surface-raised, #ffffff) |
Theme tokens it reads
| Token | Default |
|---|---|
--slotted-border-subtle | Set per scheme by the theme |
--slotted-border-width-thin | 1px |
--slotted-control-border-color | Set per scheme by the theme |
--slotted-control-border-width | var(--slotted-border-width-thin) |
--slotted-control-focus-ring-offset | var(--slotted-focus-ring-offset) |
--slotted-control-font-family | var(--slotted-font-family-sans) |
--slotted-control-font-size-lg | comfortable 14px · compact 13px · dense 12px |
--slotted-control-font-size-md | comfortable 13px · compact 12px · dense 12px |
--slotted-control-font-size-sm | comfortable 12px · compact 12px · dense 12px |
--slotted-control-gap-lg | comfortable 8px · compact 6px · dense 6px |
--slotted-control-gap-md | comfortable 8px · compact 6px · dense 4px |
--slotted-control-gap-sm | comfortable 6px · compact 4px · dense 4px |
--slotted-control-height-lg | comfortable 38px · compact 32px · dense 30px |
--slotted-control-height-md | comfortable 34px · compact 28px · dense 26px |
--slotted-control-height-sm | comfortable 30px · compact 26px · dense 24px |
--slotted-control-icon-size-lg | comfortable 18px · compact 16px · dense 14px |
--slotted-control-icon-size-md | comfortable 16px · compact 14px · dense 13px |
--slotted-control-icon-size-sm | comfortable 14px · compact 13px · dense 12px |
--slotted-control-inner-size-lg | comfortable 28px · compact 24px · dense 22px |
--slotted-control-inner-size-md | comfortable 24px · compact 20px · dense 18px |
--slotted-control-inner-size-sm | comfortable 22px · compact 18px · dense 16px |
--slotted-control-invalid-edge-width | var(--slotted-border-width-thin) |
--slotted-control-padding-inline-lg | comfortable 16px · compact 12px · dense 10px |
--slotted-control-padding-inline-md | comfortable 13px · compact 10px · dense 8px |
--slotted-control-padding-inline-sm | comfortable 10px · compact 8px · dense 6px |
--slotted-control-radius | var(--slotted-radius-sm) |
--slotted-control-shadow | Set per scheme by the theme |
--slotted-control-shadow-focus-geometry | 0 1px 4px -1px |
--slotted-control-surface | Set per scheme by the theme |
--slotted-control-transition-duration | var(--slotted-duration-short) |
--slotted-control-transition-easing | var(--slotted-easing-standard) |
--slotted-disabled-background | Set per scheme by the theme |
--slotted-disabled-border | Set per scheme by the theme |
--slotted-disabled-foreground | Set per scheme by the theme |
--slotted-duration-medium | 200ms |
--slotted-duration-short | 120ms |
--slotted-easing-enter | cubic-bezier(0.05, 0.7, 0.1, 1) |
--slotted-easing-exit | cubic-bezier(0.3, 0, 0.8, 0.15) |
--slotted-easing-standard | cubic-bezier(0.2, 0, 0, 1) |
--slotted-focus-ring-color | Set per scheme by the theme |
--slotted-focus-ring-color-invalid | Set per scheme by the theme |
--slotted-focus-ring-offset | var(--slotted-border-width-thick) |
--slotted-focus-ring-width | var(--slotted-border-width-thick) |
--slotted-font-family-sans | 'Geist Variable', ui-sans-serif, system-ui, sans-serif |
--slotted-font-size-xs | 0.75rem |
--slotted-font-weight-medium | 500 |
--slotted-font-weight-semibold | 600 |
--slotted-line-height-md | 1.5 |
--slotted-line-height-sm | 1.45 |
--slotted-overlay-max-block-size | 100vh |
--slotted-radius-lg | 8px |
--slotted-radius-none | 0px |
--slotted-shadow-md | Set per scheme by the theme |
--slotted-space-1 | 0.125rem |
--slotted-space-2 | 0.25rem |
--slotted-space-5 | 0.75rem |
--slotted-surface-raised | Set per scheme by the theme |
--slotted-surface-sunken | Set per scheme by the theme |
--slotted-target-comfortable | 44px |
--slotted-target-min | 24px |
--slotted-text | Set per scheme by the theme |
--slotted-text-muted | Set per scheme by the theme |
--slotted-tone-accent-border | Set per scheme by the theme |
--slotted-tone-accent-surface | Set per scheme by the theme |
--slotted-tone-accent-text | Set per scheme by the theme |
--slotted-tone-danger-border | Set per scheme by the theme |
--slotted-tone-secondary-subtle-active | Set per scheme by the theme |
--slotted-tone-secondary-subtle-hover | Set per scheme by the theme |
--slotted-z-index-popover | 1100 |