Talisman LogoTalisman Logo Design System
Browse documentation
Components

Creatable multi-select

A text field where people type values and press Enter to turn each one into a badge, with optional suggestions.

Stableimport { CreatableMultiSelect } from "@repo/ui/creatable-multi-select";Source

Type a value and press Enter. Pasting several lines from a spreadsheet creates one badge per cell.

When to use

  • To collect a list of free values, such as process numbers, e-mails or keywords.
  • To accept a paste of many values from a spreadsheet at once.
  • When suggestions help but are not the only valid answer.

When not to use

  • Choosing only from a closed list. Use the multiple selector.
  • A single free value. Use an Input.
  • Values that must be validated against the server before they appear. Build the check outside the field, because the component accepts any text.

Variants

Variant Use for
default A compact field with a secondary border.
form Forms. Primary border, rounded corners and a focus ring when the field is focused.

States

Disabled

Examples

Suggestions

With options, a list opens under the field while typing. Matching an option label exactly selects that option. Any other text becomes a new badge.

Narrow containers

constrainBadges truncates long labels and shows the full text in a tooltip.

Limit the number of values

maxSelected stops new badges and calls onMaxSelected. Tell the user why nothing was added.

Content

  • Placeholders explain the gesture: “Digite e pressione Enter”.
  • Keep splitOnWhitespace on for identifiers without spaces, such as process numbers. Turn it off for labels that may contain spaces, such as “Revisão pendente”.
  • Use onMaxSelected to show a message in the page. The field gives no feedback by itself.

Accessibility

  • The wrapper has role="combobox" and aria-expanded, and the text input inside it receives the typing. Pass inputProps={{ "aria-label": "…" }} so the input has a name.
  • Enter creates a badge. Backspace or Delete on an empty input removes the last badge, except fixed ones. Escape closes the suggestions.
  • The remove button of each badge can be reached with Tab and shows a focus ring.
  • Suggestions are plain buttons in a portal. They are not announced as a list box and arrow keys do not move through them.

Code

import { CreatableMultiSelect } from "@repo/ui/creatable-multi-select";
import type { CreatableOption } from "@repo/ui/creatable-multi-select";

const [value, setValue] = useState<CreatableOption[]>([]);

<CreatableMultiSelect
  inputProps={{ "aria-label": "Números de processo" }}
  onChange={setValue}
  placeholder="Digite e pressione Enter"
  value={value}
  variant="form"
/>;

Props

CreatableMultiSelect
PropTypeDefaultDescription
constrainBadgesbooleanfalseTruncates long badge labels and shows the full text in a tooltip
disabledboolean—Blocks typing and removing badges
hideClearAllButtonbooleanfalseHides the button that clears every badge
hidePlaceholderWhenSelectedboolean—Hides the placeholder once there is at least one badge
maxSelectednumberNumber.MAX_SAFE_INTEGERMaximum number of badges
placeholderstring""Hint shown in the input
splitOnWhitespacebooleantrueSplits typed or pasted text on spaces into several badges. When false, the whole text is one badge
variant"default" | "form"defaultBorder and focus style of the field
More props
PropTypeDefaultDescription
valueCreatableOption[]—Selected options. The component keeps its own copy and calls onChange.
onChange(options: CreatableOption[]) => void—Called with the full list after every change.
onInputChange(value: string) => void—Called when the typed text changes.
optionsCreatableOption[][]Suggestions shown while typing.
onMaxSelected(maxLimit: number) => void—Called when the user tries to exceed maxSelected.
inputPropsInputHTMLAttributes<HTMLInputElement>—Props for the text input, such as aria-label and className.
badgeClassNamestring—Extra classes for the badges, for spacing only.
CreatableOption
PropTypeDefaultDescription
valuestring—Unique identifier.
labelstring—Text shown in the badge.
fixedboolean—Keeps the badge in place, without a remove button.

Known issues

Issue Effect
The wrapper div has role="combobox", tabIndex={0} and aria-label="Multi-select input", and contains the real input and buttons. Screen readers find a combobox inside a combobox, and the fixed English name cannot be translated.
The remove button on each badge and the clear-all button have no accessible name. Screen readers announce “button” with no purpose.
The clear-all button has no focus style and an icon-only 24px target. Keyboard users cannot see where focus is.
Suggestions use hover:bg-accent and have no role="option" or keyboard navigation. Users cannot choose a suggestion with arrow keys. It depends on a token from the old color system.
Disabled uses opacity-70 on the whole field. Opacity lowers contrast instead of using disabled tokens.
The default variant has no focus ring. Focus is only visible through the text caret.
CreatableOption accepts [key: string]: any. Loses type safety on extra fields.
Edit this page on GitHub