Introducing PrimeReact v11-alpha 🎉Discover Now

InputTags

An unstyled tag input component with keyboard navigation, delimiter support, and optional typeahead suggestions.

Build fully custom tag input fields with complete control over layout and styling.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use InputTags with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Tag creation on Enter key press with optional delimiter character
  • Maximum tag limit with max prop
  • Duplicate prevention with allowDuplicate
  • Optional typeahead suggestion dropdown via options and onComplete
  • Add and remove event callbacks for fine-grained control
  • Paste support with addOnPaste and automatic delimiter splitting

Usage#

import { InputTags } from 'primereact/inputtags';
<InputTags.Root>
    <InputTags.Items>
        <InputTags.Item>
            <InputTags.Label />
            <InputTags.Remove />
        </InputTags.Item>
    </InputTags.Items>
    <InputTags.Input />
</InputTags.Root>

With Positioner#

When options are provided for typeahead support, use Portal, Positioner, Popup, and List sub-components to render the suggestion dropdown.

import { InputTags } from 'primereact/inputtags';
 
<InputTags.Root options={filteredItems} optionLabel="label" onComplete={search}>
    <InputTags.Items>
        <InputTags.Item>
            <InputTags.Label />
            <InputTags.Remove />
        </InputTags.Item>
    </InputTags.Items>
    <InputTags.Input />
    <InputTags.Portal>
        <InputTags.Positioner sideOffset={4}>
            <InputTags.Popup>
                <InputTags.List />
            </InputTags.Popup>
        </InputTags.Positioner>
    </InputTags.Portal>
</InputTags.Root>;

Behavior#

Motion Animation#

<InputTags.Popup motionProps={{ name: 'p-inputtags' }}>...</InputTags.Popup>

See Motion for animation phases, CSS variables, and hide strategies.

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<InputTags.Root as="section">
    <InputTags.Input as={CustomInput} />
</InputTags.Root>

Render Function Children#

InputTags.Root accepts a render function as children, providing access to the component instance for custom tag rendering and imperative actions like onItemRemoveClick and onRemoveAllItems.

<InputTags.Root>
    {(instance) => (
        <>
            {instance?.state.value.map((value, index) => (
                <span key={index}>
                    {value}
                    <button onClick={() => instance?.onItemRemoveClick(index)}>×</button>
                </span>
            ))}
            <InputTags.Input />
        </>
    )}
</InputTags.Root>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

InputTagsRoot#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsRootInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsRootInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsRootInstance
The instance to pass to the component.
ptSafeRecord<InputTagsRootPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsRootInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
valuestring[]
Value of the items.
defaultValuestring[]
Default value of the items.
inputValuestring
Value of the input field (controlled).
defaultInputValuestring
Default value of the input field.
openboolean
Controlled open state of the input tags overlay.
defaultOpenboolean
Default open state for uncontrolled mode.
maxnumber
Maximum number of items allowed.
delimiterstring | RegExp
Delimiter character or regex to split input into items.
allowDuplicateboolean
Whether to allow duplicate items.
addOnBlurboolean
Whether to add item on blur event.
addOnPasteboolean
Whether to add item on paste event.
addOnTabboolean
Whether to add item on tab key press.
optionsunknown[]
An array of options to display in dropdown.
optionKeystring
Unique key for each option.
optionLabelstring
Label field for each option.
optionValuestring
Value field for each option.
optionDisabledstring
Field to check if an option is disabled.
optionGroupLabelstring
Label field for option groups.
optionGroupChildrenstring
Field that contains the children options in a group.
delaynumber
Delay between keystrokes to wait before sending a query.
minLengthnumber
Minimum number of characters to initiate a search.
appendTo"body" | HTMLElement | "self"
A valid query selector or an HTMLElement to specify where the overlay gets attached.
closeOnEscapeboolean
When enabled, the overlay closes when Escape key is pressed.
autoFocusboolean
When enabled, the overlay receives focus automatically when opened.
trappedboolean
When enabled, focus is trapped within the overlay.
onAdd(event: useInputTagsAddEvent) => void
Callback to invoke when a item is added.
onRemove(event: useInputTagsRemoveEvent) => void
Callback to invoke when a item is removed.
onInputValueChange(event: useInputTagsInputValueChangeEvent) => void
Callback when the input value changes.
onComplete(event: useInputTagsCompleteEvent) => void
Callback to invoke to search for suggestions.
onOpenChange(event: useInputTagsOpenChangeEvent) => void
Callback to invoke when the open state changes.
disabledboolean
When present, it specifies that the component should be disabled.
namestring
Name of the input element.
invalidboolean
When present, it specifies that the component should have invalid state style.
variant"outlined" | "filled"
Specifies the input variant of the component.
fluidboolean
When enabled, the component spans the full width of its parent.
onValueChange(event: InputTagsRootValueChangeEvent) => void
Callback fired when the inputtags's value changes.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"root"

Defines passthrough(pt) options of InputTags component.

labeltypedescription
rootInputTagsRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
itemInputTagsRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the item's DOM element.
pcInputTextInputTagsRootPassThroughType<InputHTMLAttributes<HTMLInputElement>>Used to pass attributes to the input's DOM element.
hiddenInputInputTagsRootPassThroughType<InputHTMLAttributes<HTMLInputElement>>Used to pass attributes to the hidden input's DOM element.
panelInputTagsRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the panel's DOM element.
optionsInputTagsRootPassThroughType<HTMLAttributes<HTMLUListElement>>Used to pass attributes to the options' DOM element.
optionInputTagsRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the option's DOM element.

InputTagsItems#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsItemsInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsItemsInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsItemsInstance
The instance to pass to the component.
ptSafeRecord<InputTagsItemsPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsItemsInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsItems component.

labeltypedescription
rootInputTagsItemsPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsItem#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsItemInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsItemInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsItemInstance
The instance to pass to the component.
ptSafeRecord<InputTagsItemPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsItemInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"item"

Defines passthrough(pt) options of InputTagsItem component.

labeltypedescription
rootInputTagsItemPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsLabel#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsLabelInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsLabelInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsLabelInstance
The instance to pass to the component.
ptSafeRecord<InputTagsLabelPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsLabelInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsLabel component.

labeltypedescription
rootInputTagsLabelPassThroughType<HTMLAttributes<HTMLElement>>Used to pass attributes to the root's DOM element.

InputTagsRemove#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsRemoveInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsRemoveInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsRemoveInstance
The instance to pass to the component.
ptSafeRecord<InputTagsRemovePassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsRemoveInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"remove"

Defines passthrough(pt) options of InputTagsRemove component.

labeltypedescription
rootInputTagsRemovePassThroughType<HTMLAttributes<HTMLElement>>Used to pass attributes to the root's DOM element.

InputTagsInput#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsInputInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsInputInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsInputInstance
The instance to pass to the component.
ptSafeRecord<InputTagsInputPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsInputInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsInput component.

labeltypedescription
rootInputTagsInputPassThroughType<HTMLAttributes<HTMLInputElement>>Used to pass attributes to the root's DOM element.

InputTagsStart#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsStartInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsStartInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsStartInstance
The instance to pass to the component.
ptSafeRecord<InputTagsStartPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsStartInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsStart component.

labeltypedescription
rootInputTagsStartPassThroughType<HTMLAttributes<HTMLElement>>Used to pass attributes to the root's DOM element.

InputTagsEnd#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsEndInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsEndInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsEndInstance
The instance to pass to the component.
ptSafeRecord<InputTagsEndPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsEndInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsEnd component.

labeltypedescription
rootInputTagsEndPassThroughType<HTMLAttributes<HTMLElement>>Used to pass attributes to the root's DOM element.

InputTagsPortal#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
style(CSSProperties | ((instance?: PortalInstance) => CSSProperties)) & (CSSProperties | ((instance?: InputTagsPortalInstance) => CSSProperties))
The style to apply to the component.
className(string | ((instance?: PortalInstance) => string)) & (string | ((instance?: InputTagsPortalInstance) => string))
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceBaseInstance<SafeRecord<PortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<PortalProps>>; attrs: Omit<SafeRecord<SafeRecord<PortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & PortalExposes & Record<PropertyKey, unknown> & useComponentPTReturnType & useComponentStyleReturnType & BaseInstance<SafeRecord<InputTagsPortalProps>, unknown, HTMLElement> & { props: SafeRecord<SafeRecord<InputTagsPortalProps>>; attrs: Omit<SafeRecord<SafeRecord<InputTagsPortalProps>>, string | number | symbol> & Record<PropertyKey, unknown> } & { state: SafeRecord; $computedSetup: SafeRecord } & InputTagsPortalExposes
The instance to pass to the component.
ptPortalPassThrough & Record<PropertyKey, unknown> & InputTagsPortalPassThrough
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: PortalInstance) => ReactNode & (instance: InputTagsPortalInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
onMounted() => void
Callback function to invoke when the portal is mounted.
onUnmounted() => void
Callback function to invoke when the portal is unmounted.
elementHTMLElement | ReactNode
The element to be rendered as the portal.
elementRefRefObject<HTMLElement>
The element reference to be rendered as the portal.
appendTostring | HTMLElement | ((instance: PortalInstance) => HTMLElement)'body'
The DOM element where the portal should be appended to.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsPortal component.

labeltypedescription
rootInputTagsPortalPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsPositioner#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsPositionerInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsPositionerInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsPositionerInstance
The instance to pass to the component.
ptSafeRecord<InputTagsPositionerPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsPositionerInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
sideSideType
The side of the positioner.
alignAlignType
The align of the positioner.
sideOffsetnumber
The side offset of the positioner.
alignOffsetnumber
The align offset of the positioner.
flipboolean
Whether to flip the positioner.
shiftboolean
Whether to shift the positioner.
hideWhenDetachedboolean
Whether to hide the positioner when detached.
strategy"fixed" | "absolute"'fixed'
The positioning strategy.
boundaryHTMLElement
The boundary element that constrains the positioner placement. Used in JS fallback mode only; CSS Anchor mode uses the containing block.
anchorHTMLElement
The anchor element.
contentHTMLDivElement
The content element.
arrowHTMLDivElement
The arrow element.
autoZIndexbooleantrue
Whether to automatically manage layering.
baseZIndexnumber0
Base zIndex value to use in layering.
onPlacementChange(placement: { side: SideType; align: AlignType }) => void
Callback invoked when the actual placement changes due to flip or shift.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"positioner"
data-side"top" | "bottom" | "left" | "right" — placement
data-align"start" | "center" | "end" — alignment

CSS Custom Properties

The positioner element exposes CSS custom properties for layout and transform control.

CSS VariableDescription
--available-heightAvailable vertical space in pixels
--available-widthAvailable horizontal space in pixels
--transform-originComputed transform origin for animations
--positioner-anchor-widthWidth of the anchor/trigger element

Defines passthrough(pt) options of InputTagsPositioner component.

labeltypedescription
rootInputTagsPositionerPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsPopup#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsPopupInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsPopupInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsPopupInstance
The instance to pass to the component.
ptSafeRecord<InputTagsPopupPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsPopupInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
motionPropsuseMotionProps
Used to apply motion to the popup element. It accepts the same properties as useMotion hook.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"popup"
data-openPresent when popup is open

Defines passthrough(pt) options of InputTagsPopup component.

labeltypedescription
rootInputTagsPopupPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsPanel#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsPanelInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsPanelInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsPanelInstance
The instance to pass to the component.
ptSafeRecord<InputTagsPanelPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsPanelInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of InputTagsPanel component.

labeltypedescription
rootInputTagsPanelPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsList#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsListInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsListInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsListInstance
The instance to pass to the component.
ptSafeRecord<InputTagsListPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsListInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"inputtags"
data-part"list"

Defines passthrough(pt) options of InputTagsList component.

labeltypedescription
rootInputTagsListPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

InputTagsOption#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsOptionInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsOptionInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsOptionInstance
The instance to pass to the component.
ptSafeRecord<InputTagsOptionPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsOptionInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
optionunknown
The option data object.
indexnumber
The index of the option in the list.
selectedboolean
Whether the option is selected.
focusedboolean
Whether the option is focused.
disabledboolean
Whether the option is disabled.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-selectedPresent when selected
data-unselectedPresent when unselected
data-focusedPresent when focused
data-disabledPresent when disabled

Defines passthrough(pt) options of InputTagsOption component.

labeltypedescription
rootInputTagsOptionPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.

InputTagsArrow#

NameTypeDefault
refRef<unknown>
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsArrowInstance) => CSSProperties)
The style to apply to the component.
classNamestring | ((instance?: InputTagsArrowInstance) => string)
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceInputTagsArrowInstance
The instance to pass to the component.
ptSafeRecord<InputTagsArrowPassThrough>
The pass-through props to pass to the component.
ptOptionsPassThroughOptions
The pass-through options to pass to the component.
unstyledboolean
Whether the component should be rendered without classes.
dtunknown
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
The styles to use for the component.
render(instance: InputTagsArrowInstance) => ReactNode
The render function to render the component with instance access.
childrenany
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any
pt-{optionName}-*-
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-side"top" | "bottom" | "left" | "right" — placement
data-align"start" | "center" | "end" — alignment

CSS Custom Properties

The arrow element exposes CSS custom properties for dynamic positioning:

CSS VariableDescription
--placer-arrow-xHorizontal offset of arrow
--placer-arrow-yVertical offset of arrow
--placer-arrow-leftLeft position of arrow element
--placer-arrow-topTop position of arrow element

Defines passthrough(pt) options of InputTagsArrow component.

labeltypedescription
rootInputTagsArrowPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

The input element has textbox role in addition to aria-describedby attribute. The tag list uses listbox role with aria-orientation set to horizontal.

When typeahead is enabled, the input element has combobox role in addition to aria-autocomplete, aria-haspopup and aria-expanded attributes. The relation between the input and the popup is created with aria-controls and aria-activedescendant attribute is used to instruct screen reader which option to read during keyboard navigation within the popup list.

Keyboard Support#

KeyFunction
tabMoves focus to the input element.
enterAdds a new tag with the current input value.
backspaceRemoves the last tag when input is empty.
left arrowMoves focus to the previous tag when input is empty.
right arrowMoves focus to the next tag when focused on a tag.

Tag Keyboard Support#

KeyFunction
backspaceRemoves the focused tag.
deleteRemoves the focused tag.
KeyFunction
tabSelects the focused option and closes the popup, then moves focus to next element in page.
enterSelects the focused option and closes the popup.
escapeCloses the popup.
down arrowMoves focus to the next option.
up arrowMoves focus to the previous option.
homeMoves focus to the first option.
endMoves focus to the last option.