Skip to main content

MultiSelect

A dropdown for choosing several values from a fixed list. The selection stays on one row, so the field keeps its height however many values are chosen.

Base
Wrapper over Mantine
Import
{ MultiSelect } from '@multiconsult-group-products/design-system'
@mantine/core exports this name too — that one is a different component.
Source
src/components/MultiSelect/MultiSelect.tsx
src/components/MultiSelect/MultiSelect.module.css
Same name as Mantine's MultiSelect

Mantine's own MultiSelect has the same field and dropdown styling, but its pills wrap onto new lines and grow the field. Import this one from the design system to get the single row and the count.

Usage​

ByggElektro
2 valgt
withClearButton
disabled
size
sm
md
lg
React
<MultiSelect label="Fagområder" placeholder="Velg fagområder" size="md" data={['Bygg', 'Elektro', 'VVS', 'Grunnarbeid']} defaultValue={['Bygg', 'Elektro']} />

Pills that do not fit whole are hidden. A badge to the left of the chevron shows the number of selected values.

Props​

Only what this component adds or removes versus Mantine's MultiSelect — read the full props table there.

PropertyTypeAllowed valuesDefaultDescription
withClearButtonboolean—falseAdds a clear-all button inside the count badge. Hidden when nothing is selected, read-only or disabled.
removeLabel(label: string) => string—label => `Fjern ${label}`Accessible name of a pill's remove button.
clearLabelstring—'Tøm valg'Accessible name of the clear-all button.
selectedLabel(count: number) => string—count => `${count} valgt`Text read by assistive technology in place of the visible count.
renderPill———Not exposed.
classNames———Not exposed.
styles———Not exposed.
placeholderstring——Hidden once a value is selected.

Accessibility​

Give the field a label. Without one it loses its accessible name once a value is selected. Hidden pills leave the tab order, and the count badge reports the total to assistive technology. See Accessibility for what applies to every component.