Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

Listbox

Pass options as { value, label, disabled? }. The machine manages roving focus, typeahead, and selection.

import { Listbox } from '@manti-ui/react';

const fillings = [
  { value: 'lamb', label: 'Lamb & onion' },
  { value: 'beef', label: 'Beef & herb' },
  { value: 'pumpkin', label: 'Pumpkin' },
  { value: 'potato', label: 'Potato', disabled: true },
  { value: 'spinach', label: 'Spinach & cheese' },
];

export default function ListboxBasic() {
  return (
    <Listbox
      items={fillings}
      label="Filling"
      variant="primary"
      defaultValue={['beef']}
    />
  );
}

Sizes

size sets the row rhythm: type, padding, and icon size. It is the same scale Select, Combobox, and Menu use, so a list next to a sm control reads at the same size.

  • Lamb & onion
  • Beef & herb
  • Pumpkin
  • Lamb & onion
  • Beef & herb
  • Pumpkin
  • Lamb & onion
  • Beef & herb
  • Pumpkin

Multiple selection

Set selectionMode="multiple" and use array values.

  • Lamb & onion
  • Beef & herb
  • Pumpkin
  • Spinach & cheese

API

PropTypeDefaultDescription
itemsListboxItem[]The options. Each item is `{ value, label, disabled? }`.
labelReactNodeOptional label rendered above the list.
variantMantiVariant'primary'Variant applied to the selected item.
size'sm' | 'md' | 'lg''md'Row rhythm: type, padding, and icon size.
selectionMode'single' | 'multiple''single'Whether one or several items can be selected.
valuestring[]Controlled selected values.
defaultValuestring[]Initial selected values for uncontrolled usage.
onValueChange(value: string[]) => voidCalled whenever the selection changes.
disabledbooleanDisable the whole list.

Styling

Anatomy

PartSelectorDescription
root[data-scope="listbox"][data-part="root"]The list wrapper carrying scope, variant, and state.
label[data-scope="listbox"][data-part="label"]Optional label above the list.
content[data-scope="listbox"][data-part="content"]The scrollable `<ul>` holding the options.
item[data-scope="listbox"][data-part="item"]A single selectable option.
item-indicator[data-scope="listbox"][data-part="item-indicator"]The checkmark shown on selected items.

Tokens

TokenControls
--manti-listbox-min-widthmin width
--manti-listbox-max-heightmax height
--manti-listbox-paddingpadding
--manti-listbox-gapgap
--manti-listbox-item-padding-yitem padding y
--manti-listbox-item-padding-xitem padding x
--manti-listbox-item-gapitem gap
--manti-listbox-item-radiusitem radius
--manti-listbox-item-font-sizeitem font size

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub