/mantine:mantine-comboboxfrom mantine
Build custom dropdown, select, autocomplete, and multiselect components using Mantine's Combobox primitives. Covers useCombobox, ComboboxPopover, store hooks, and virtualized lists.
Ships in mantine. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Written for Mantine 10.x. Upgrading code written for 9.x: see Coming from 9.x.
Combobox provides low-level primitives for building any select-like UI. The built-in
Select, MultiSelect, Autocomplete, and TagsInput components are all built on top of it.
Build with Combobox primitives only when none of these fit:
| Need | Use |
|---|---|
| Standard select, multi-select, autocomplete or tags input | Select, MultiSelect, Autocomplete, TagsInput (all support renderOption) |
| One of those plus extra logic (create an option from the search text, open or submit from outside) | The same component with its store hook: useSelect, useMultiSelect, useTagsInput, useAutocomplete (see below) |
| Options dropdown attached to a button or any other element, no input | ComboboxPopover (data-driven: data, value, onChange, searchable, multiple) |
| Hierarchical options | TreeSelect (see below) |
| More than a few hundred options | Combobox with useVirtualizedCombobox, see the virtualized pattern |
<ComboboxPopover data={['React', 'Angular', 'Vue']} value={value} onChange={setValue}>
<ComboboxPopover.Target>
<Button variant="default">{value || 'Select framework'}</Button>
</ComboboxPopover.Target>
</ComboboxPopover>
ComboboxPopover opens on target click by itself, marks the selected option with a check icon and
handles keyboard navigation. Useful props: searchable, multiple (value becomes string[], the
dropdown stays open while picking), allowDeselect={false} (one option is always selected),
nothingFoundMessage, renderOption, limit, maxDropdownHeight, name (hidden input for forms),
comboboxProps={{ width: 220, position: 'bottom-start' }}. data supports disabled items and groups
like Select: [{ group: 'Size', items: [{ value: 'xs', label: 'XS' }] }]. It cannot render custom dropdown content (tabs, header, footer, create actions): use
Combobox primitives for that.
The store hooks extend a built-in component without rebuilding it. The store includes every
useCombobox action (openDropdown, closeDropdown, selectFirstOption, …) plus the
component's own state (getValue, setValue, getSearch, setSearch), and is passed to the
store prop. 9.x: comboboxProps={{ store }} with a useCombobox store; ignored in 10.x.
function CreatableSelect({ data, onCreate, value, defaultValue, onChange, ...others }: CreatableSelectProps) {
const store = useSelect({
value,
defaultValue,
onChange: (item, option) => {
if (item !== null && !data.includes(item)) {
onCreate(item);
}
onChange?.(item, option);
},
});
const search = store.getSearch().trim();
const canCreate = search !== '' && !data.includes(search);
return (
<Select
{...others}
store={store}
searchable
data={canCreate ? [...data, search] : data}
renderOption={({ option }) => (data.includes(option.value) ? option.label : `+ Create ${option.label}`)}
/>
);
}
TreeSelect takes nested data ({ value, label, children? }[], unique values) and renders an
input with an expandable tree in the dropdown. Props include mode (single, multiple, or checkbox
with parent-child cascade), searchable, clearable, renderNode. Build the tree from Combobox
primitives instead when you need a different layout: only leaves selectable, a flat list of search
results with full paths, or a button trigger. In that case render every visible row as a
Combobox.Option and decide in onOptionSubmit whether the row selects or expands.
const combobox = useCombobox({
onDropdownClose: () => combobox.resetSelectedOption(),
onDropdownOpen: () => combobox.selectFirstOption(),
});
<Combobox store={combobox} onOptionSubmit={handleSubmit}>
<Combobox.Target targetType="button">
<InputBase
component="button"
type="button"
pointer
rightSection={<Combobox.Chevron />}
onClick={() => combobox.toggleDropdown()}
>
{value || <Input.Placeholder>Pick value</Input.Placeholder>}
</InputBase>
</Combobox.Target>
<Combobox.Dropdown>
<Combobox.Options>
{options.map((item) => (
<Combobox.Option value={item} key={item}>{item}</Combobox.Option>
))}
</Combobox.Options>
</Combobox.Dropdown>
</Combobox>
const handleSubmit = (val: string) => {
setValue(val);
combobox.closeDropdown();
};
| Scenario | Use |
|---|---|
| Button trigger (no text input) | <Combobox.Target targetType="button"> |
| Input trigger | <Combobox.Target> (default) |
| Pills + separate input (multi-select) | <Combobox.DropdownTarget> + <Combobox.EventsTarget> |
targetType="button", Space and Enter also open it, Home and End jump to the
first and last option, and typing letters highlights the first option whose text starts with
them (typeahead; not with useVirtualizedCombobox). Tab is not handled. 9.x: no Home, End or
typeahead.role="combobox", aria-expanded and (input targets) aria-autocomplete="list".
Set withExpandedAttribute={false} on Combobox.Target to drop them when the trigger is not a
combobox in the ARIA sense. 9.x: off by default.selectFirstOption()
or selectActiveOption().onOptionSubmit.Combobox.Option forwards data-* attributes and event handlers to its element.Combobox.Search handles the same keys as the target. Your own onKeyDown on the target child or
on Combobox.Search is called first, then the built-in handling runs, so extra keys (PageUp,
ArrowRight) can be added there. To take the keyboard over completely (a textarea, where arrows
must move the caret), set withKeyboardNavigation={false} on Combobox.Target and call
selectNextOption, selectPreviousOption and clickSelectedOption yourself.width="target"), rendered in a portal, kept
mounted while closed, opens without animation, and hovering an option does not change the
keyboard highlight.Modal, Escape closes only the dropdown; a second Escape closes the modal. No extra code is needed.onOptionSubmit can toggle, expand a row or run an
action, and decides itself whether to close the dropdown.Combobox.Header, a Retry link) is not
handled: add onMouseDown={(event) => event.preventDefault()} to it so the input keeps focus and
an onBlur handler does not close the dropdown.Two words that are easy to mix up:
data-combobox-selected).active prop
(data-combobox-active). It has no styles by default: render a check icon.Load the mantine-ui skill together with this one (and mantine-testing when you write tests):
colors, sizes and the input + button row come from there.
A pick that leaves the user in the field keeps the dropdown open. When an option continues the input instead of finishing it (a filter key that now needs a value, a token after which the next one is typed, a folder whose subfolders come next, any multi-value input), the dropdown stays open with the next list, for keyboard and mouse picks alike. Only a pick that completes the value closes it.
Highlight the first option only while the text cannot be committed as typed. When the text
is incomplete (priority: waiting for a value, fri 5 that only a suggestion turns into a
date), the first option is highlighted so Enter takes it. When the text is already a complete
value (a finished token in a search, an existing folder path), nothing is highlighted: Enter
submits the form or runs the search and Tab leaves the field; ArrowDown, ArrowRight or /
continue into the list. A highlight that is always on makes Enter drill one level deeper and
Tab complete instead of moving on, so the user saves somewhere they did not mean to. Decide in
an effect keyed on the text (the new options exist only after the next render):
useEffect(() => { if (!combobox.dropdownOpened) return; isComplete(text) ? combobox.resetSelectedOption() : combobox.selectFirstOption(); }, [text]).
An explicit drill-down keeps keyboard navigation continuous. When ArrowRight picks a folder and replaces its options with its children, highlight the first child after the new list renders so another ArrowRight can continue without ArrowDown. Treat this as a one-shot exception to the complete-value rule above, then clear the drill-down intent. Directly typing or focusing a complete path still leaves nothing highlighted so Enter saves and Tab leaves the field; an empty child list has nothing to highlight.
Enter is never ignored silently. An input that cannot commit what was typed (a date parser, a picker with a fixed list) takes the highlighted suggestion on Enter, or shows the error it would show on blur. Typed text that does nothing on Enter while suggestions are visible reads as a broken field.
Every options list scrolls inside a height cap. Wrap options in Combobox.ScrollArea with
mah of about 300px (or floatingHeight="viewport") even when today's data is short: lists
grow, and on a phone the on-screen keyboard takes half the screen, so a 600px dropdown leaves
four options visible and makes the user scroll the page instead of the list.
Backspace in an empty text part removes the last pill or token whole, like MultiSelect
and TagsInput. It never turns the token back into editable text.
Options keep their own labels. An option shows the label defined for it, with the same
casing in the filtered list as in the unfiltered one (Tomorrow, Next week), never the typed
query echoed back or re-cased. Options generated from phrases (tomorrow at 5pm, next monday)
are displayed in sentence case with proper names capitalized (Tomorrow at 5pm,
Next Monday), even when they are matched and stored in lowercase.
Everything inside the highlighted option is readable. [data-combobox-selected] paints the
option with the filled primary color and white text. Text and icons inside it that set their
own color (a bright title, a -text colored icon, a secondary line, a counter) keep that color
and become unreadable: reset them under the highlight.
.option[data-combobox-selected] :is(.title, .icon, .meta) {
color: inherit;
}
The current value is marked without tints. The active option gets a check icon in a list
and a 1px solid var(--mantine-primary-color-filled) outline in a grid; never a -light
background (--mantine-primary-color-light is the banned light variant in CSS form).
A virtualized grid uses Combobox.ScrollArea, a bounded dropdown and minimal reveal scrolling.
Pass its viewport to the virtualizer with viewportRef, set mah, and keep that viewport mounted
through empty searches. Give the dropdown an explicit width for the grid instead of width="target";
cap it against the screen with Combobox.Dropdown's maxWidth. On keyboard movement, scroll only
when the highlighted cell is outside the actual viewport: bring the next row just into view at
the bottom (or the previous row at the top), rather than calling scrollToIndex on every key.
scrollToIndex({ align: 'auto' }) can move the entire grid on every Arrow Down, keeping the
highlight stuck in the first visible row. See Virtualized list.
An icon picker stays compact and navigable across sections. Within a roughly 376px dropdown,
prefer eight 40px cells per row with 4px gaps and icons no larger than 20px. Keep recently picked
icons in the same scrollable listbox and keyboard order as search results, with section labels
instead of separate buttons and dividing borders. Preserve each recent icon's style, even when
the selected style filter differs. Keep the search and style controls together without a divider,
center the empty state, and use a subtle outline only for the current value. Put a search icon
inside an outlined search field and the clear control inside the button-like input target. The
default Combobox.Search has edge-to-edge styling: override its input element (not merely its
wrapper) when the controls should be inset and the search field fully bordered. See
Clear button for a trigger that does not reopen on clear.
Controls in the dropdown keep focus in the search field when clicked, but not on keyboard changes.
onMouseDown={(event) => event.preventDefault()} is enough for buttons, not for controls built
on labels and inputs (SegmentedControl, Chip, Checkbox): clicking a label focuses its
input anyway. Refocus search after pointer changes, but allow Arrow Left/Right on a focused
SegmentedControl to change its value without moving focus away from its radio inputs.
A dropdown with controls besides the options traps focus. When the keyboard user must reach
something other than the search field and the options (a style switch, tabs, filters), Tab
would otherwise move focus out of the dropdown and leave it open behind the page. Wrap the
dropdown content in FocusTrap: Tab cycles search → controls → search, Escape closes the
dropdown from any of them, and onDropdownClose: () => combobox.focusTarget() returns focus.
A dropdown with only a search field and options needs no trap: Tab moves on and closes it
(closeDropdown() in the search field's onBlur).
const pointerChange = useRef(false);
<Combobox.Dropdown>
<FocusTrap active={combobox.dropdownOpened}>
<div>
<Combobox.Search />
<SegmentedControl
data={STYLES}
onPointerDownCapture={() => { pointerChange.current = true; }}
onKeyDownCapture={() => { pointerChange.current = false; }}
onChange={(next) => {
setStyle(next);
if (pointerChange.current) combobox.focusSearchInput();
pointerChange.current = false;
}}
/>
<Combobox.Options>{/* … */}</Combobox.Options>
</div>
</FocusTrap>
</Combobox.Dropdown>
Large option data is loaded when it is needed. A whole icon set, emoji list or a dataset of
thousands of records imported at the top of the module ends up in the bundle of every page that
imports the input (all of @tabler/icons-react is several megabytes). Load it with import()
the first time the dropdown opens (show a Loader in the dropdown meanwhile), and render the
displayed value from the same loaded module, with its name as a fallback until it arrives.
The search field and the other controls render right away; only the options area shows the
Loader. A dropdown that holds nothing but a loader on the first open leaves FocusTrap and
data-autofocus without a target, and the search field never gets focus once it appears.
combobox.selectedOptionIndex and combobox.listId no longer exist: call
combobox.getSelectedOptionIndex() and combobox.getListId().comboboxProps={{ store }} on Select, MultiSelect, TagsInput and Autocomplete is ignored:
create the store with useSelect, useMultiSelect, useTagsInput or useAutocomplete and pass
it to the store prop.Combobox.Target sets role="combobox" and aria-expanded by default
(withExpandedAttribute={false} restores the 9.x markup). Button targets handle Home, End and
typeahead on their own.Combobox.ScrollArea replaces ScrollArea.Autosize type="scroll" inside dropdowns; the
patterns mark the 9.x fallback.dropdownOpened changes, so it can be a useEffect
dependency without running the effect on every render.useUncontrolled need no key={form.key(path)} with @mantine/form:
form.key is gone.--mantine-color-hover, --mantine-disabled-opacity, --mantine-color-border), and the
dropdown background is the page surface. CSS that overrides the 9.x gray-N / dark-N values
should be checked in dark mode.Read both before building anything beyond the basic select above:
references/patterns.md — complete examples: searchable select (input trigger), free-text input with suggestions, suggestions for a textarea (mentions), custom styles with a CSS module, virtualized list for thousands of options, custom form input built on Combobox, search inside the dropdown, multi-select with pills, creatable option, async search with loading and error states, groups, custom option rendering, highlighting the current value on open, clear button, form integration, dropdown that fits the viewportreferences/api.md — useCombobox options and every store method with what it does, default styles and how to override them, useVirtualizedCombobox, all sub-component props including Combobox.ScrollArea, CSS variables, Styles API selectorsIf the references do not cover what you need, do not guess:
@mantine/mcp-server) is connected, use search_docs and get_item_dochttps://mantine.dev/llms.txt and open the Combobox page. More than 50 complete examples are at https://mantine.dev/combobox/What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/mantine-calendarBuild custom calendars and date pickers with @mantine/dates: per-day content and states, your own selection rules, custom periods and display-only calendars. Use this skill when: (1) a calendar shows data per day (prices, free slots, event dots, activity heatmap), (2) days are unavailable with a reason, or a range must not cross booked days, (3) the selection is not a plain date, dates or range (stays, fixed-length periods, fiscal quarters, week or custom-period pickers), (4) a calendar sits next to time slots, presets or a toolbar, or (5) any task involving Calendar, useCalendar, getDayProps, renderDay, excludeDate, getMonthControlProps, Month, Day, CalendarHeader or PickerControl.
/mantine-custom-componentsBuild custom components that integrate with Mantine's theming, Styles API, and core features. Use this skill when: (1) creating a new component using factory(), polymorphicFactory(), or genericFactory(), (2) adding Styles API support (classNames, styles, vars, unstyled), (3) implementing CSS variables via createVarsResolver, (4) building compound components with sub-components and shared context, (5) registering a component with MantineProvider via Component.extend(), or (6) any task involving Factory, useProps, useStyles, BoxProps, StylesApiProps, or ElementProps in @mantine/core.
npx claudepluginhub mantinedev/skills --plugin mantineOther plugins' skills for the same job