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

TagsInput

Press Enter to add a tag and Backspace to remove the last one. The machine manages editing, navigation, and hidden form values.

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

export default function TagsInputBasic() {
  return (
    <div className="w-full max-w-[calc(var(--manti-space-16)*7)]">
      <TagsInput
        label="Fillings"
        variant="primary"
        defaultValue={['lamb', 'onion', 'pepper']}
        placeholder="Add a filling…"
      />
    </div>
  );
}

State and limits

Use max, invalid, disabled, readOnly, and required as needed.

lambonion
lambonion
lambonion

API

PropTypeDefaultDescription
labelReactNodeOptional field label.
variantMantiVariant'primary'Focus-ring variant.
valuestring[]Controlled tag values.
defaultValuestring[]Initial tag values for uncontrolled usage.
onValueChange(value: string[]) => voidCalled whenever the tag set changes.
maxnumberMaximum number of tags.
allowDuplicatesbooleanAllow duplicate tags.
addOnPastebooleanAdd a tag when pasting delimited text.
placeholderstringPlaceholder for the entry input.
disabled / readOnly / invalid / requiredbooleanField state flags.
namestringForm field name.

Styling

Anatomy

PartSelectorDescription
root[data-scope="tags-input"][data-part="root"]The component container.
label[data-scope="tags-input"][data-part="label"]The optional label.
control[data-scope="tags-input"][data-part="control"]The chips-and-input frame.
item-preview[data-scope="tags-input"][data-part="item-preview"]A rendered tag chip.
item-delete-trigger[data-scope="tags-input"][data-part="item-delete-trigger"]The remove button on a chip.
item-input[data-scope="tags-input"][data-part="item-input"]The inline edit input for a chip.
input[data-scope="tags-input"][data-part="input"]The entry input for new tags.

Tokens

TokenControls
--manti-tags-input-heightheight

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