Forms

Multi-select.

Search, choose and remove several options in one field.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/multi-select.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Grouped reviewers with controlled opening

Keep selected IDs while searching groups and removing individual choices.

Keyboard

  • Type a name, description or alias to narrow the list.
  • Arrow keys and Enter choose an enabled reviewer.
  • Use each chip removal action or Backspace when the input is empty; Escape closes options first.

States covered

  • controlled value
  • controlled popup
  • groups
  • icons
  • descriptions
  • disabled option
  • native form
  • clear all

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-multi-select-grouped-reviewers.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { useRef, useState } from 'react';
import { User } from 'lucide-react';
import { Button, MultiSelect, type Option } from '@bld8/ui';
const reviewers: Option[] = [
  { value: 'avery', label: 'Avery Stone', group: 'Contributors', icon: User, description: 'Quality review.', searchTerms: ['qa'] },
  { value: 'jules', label: 'Jules Park', group: 'Contributors', icon: User, description: 'Product review.' },
  { value: 'noor', label: 'Noor Sethi', group: 'Owners', icon: User, description: 'Unavailable for new reviews.', disabled: true }
];
export default function GroupedMultiSelectExample() {
  const [value, setValue] = useState<string[]>(['avery']);
  const [open, setOpen] = useState(false);
  const [submitted, setSubmitted] = useState('Not submitted');
  const input = useRef<HTMLInputElement>(null);
  return <form aria-label="Review panel example" onSubmit={event => {
    event.preventDefault(); setSubmitted(new FormData(event.currentTarget).getAll('reviewers').map(String).join(', '));
  }} style={{ display: 'grid', gap: 16, maxWidth: 440 }}>
    <MultiSelect label="Review panel" name="reviewers" options={reviewers} value={value} onValueChange={setValue}
      open={open} onOpenChange={setOpen} inputRef={input} clearable hint="The form receives reviewer IDs." />
    <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}><Button variant="secondary" onClick={() => { input.current?.focus(); setOpen(true); }}>Open reviewer list</Button><Button type="submit">Read reviewer IDs</Button></div>
    <output aria-label="Reviewer form values">{submitted}</output>
  </form>;
}

Required choices and field errors

Keep validation explicit and preserve selected values while the field recovers.

Keyboard

  • Submit to show the field error and focus the input.
  • Choose an option with ArrowDown and Enter.
  • Remove a choice with its labelled chip action; disabled managed choices stay unchanged.

States covered

  • required
  • invalid
  • recovery
  • disabled field
  • compact density

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-multi-select-validation.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { useRef, useState } from 'react';
import { Button, MultiSelect, type Option } from '@bld8/ui';
const reviewers: Option[] = [{ value: 'erin', label: 'Erin Vale' }, { value: 'tomas', label: 'Tomas Reed' }];
export default function ValidatedMultiSelectExample() {
  const [value, setValue] = useState<string[]>([]);
  const [attempted, setAttempted] = useState(false);
  const [submitted, setSubmitted] = useState('Not submitted');
  const input = useRef<HTMLInputElement>(null);
  return <form aria-label="Required reviewers example" noValidate onSubmit={event => {
    event.preventDefault(); setAttempted(true);
    if (!value.length) { setSubmitted('Choose a reviewer first.'); input.current?.focus(); }
    else setSubmitted(new FormData(event.currentTarget).getAll('requiredReviewers').map(String).join(', '));
  }} style={{ display: 'grid', gap: 16, maxWidth: 440 }}>
    <MultiSelect label="Required reviewers" name="requiredReviewers" options={reviewers} value={value} onValueChange={setValue} inputRef={input}
      required density="compact" error={attempted && !value.length ? 'Choose at least one reviewer.' : undefined} hint="One or more reviewers are required." />
    <MultiSelect label="Managed review panel" options={reviewers} defaultValue={['tomas']} disabled />
    <Button type="submit">Check reviewers</Button><output aria-label="Required reviewer form values">{submitted}</output>
  </form>;
}

Quick reference

React / TypeScript
<MultiSelect label="Disciplines"
  options={[{value:"design",label:"Design"},{value:"engineering",label:"Engineering"}]}
  value={disciplines} onValueChange={setDisciplines} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Base UI manages chip focus, Backspace removal, search and keyboard selection. Values are stable string IDs; labels can change independently. Supports controlled/default value and popup state, hint/error, name/form, disabled, required, input ref and blur. Rich options share descriptions, icons, groups and search terms with the local choices. Compact density, hidden visual labels and a clear action are optional. Custom rows must remain presentational.

MultiSelect

MultiSelect public properties
PropTypeDefault
labelRequiredstring—
optionsRequiredreadonly Option[]

Stable, unique values. Rich labels never replace submitted IDs.

—
clearableboolean | undefinedfalse
defaultOpenboolean | undefinedfalse
defaultValuestring[] | undefined[]
density"compact" | "comfortable" | undefined'comfortable'
disabledboolean | undefined—
emptyMessagestring | undefined'No matching options.'
errorstring | undefined—
formstring | undefined—
hintstring | undefined—
inputRefRef<HTMLInputElement> | undefined—
labelVisibility"hidden" | "visible" | undefined'visible'
namestring | undefined—
onBlurFocusEventHandler<HTMLInputElement> | undefined—
onOpenChange((open: boolean) => void) | undefined—
onOpenChangeComplete((open: boolean) => void) | undefined—
onValueChange((value: string[]) => void) | undefined—
openboolean | undefined—
placeholderstring | undefined'Choose options…'
renderOption((option: Option) => ReactNode) | undefined

A presentational row body; do not add nested interactive elements.

—
requiredboolean | undefined—
valuestring[] | undefined—

Option

Option public properties
PropTypeDefault
labelRequiredstring—
valueRequiredstring—
descriptionstring | undefined—
disabledboolean | undefined—
groupstring | undefined—
iconLucideIcon | undefined—
searchTermsstring[] | undefined—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.