InputTags API

API documentation for InputTags component

InputTagsRoot#

Props#

Defines valid properties in InputTags component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsRootInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsRootInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsRootPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsRootInstance) => ReactNode)
null
The children to render.
disabledboolean
null
When present, it specifies that the component should be disabled.
namestring
null
Name of the input element.
invalidboolean
null
When present, it specifies that the component should have invalid state style.
variant"outlined" | "filled"
null
Specifies the input variant of the component.
fluidboolean
null
When enabled, the component spans the full width of its parent.
onValueChange(event: InputTagsRootValueChangeEvent) => void
null
Callback fired when the inputtags's value changes.
valuestring[]
null
Value of the items.
defaultValuestring[]
null
Default value of the items.
inputValuestring
null
Value of the input field (controlled).
defaultInputValuestring
null
Default value of the input field.
openboolean
null
Controlled open state of the input tags overlay.
defaultOpenboolean
null
Default open state for uncontrolled mode.
maxnumber
null
Maximum number of items allowed.
delimiterstring | RegExp
null
Delimiter character or regex to split input into items.
allowDuplicateboolean
null
Whether to allow duplicate items.
addOnBlurboolean
null
Whether to add item on blur event.
addOnPasteboolean
null
Whether to add item on paste event.
addOnTabboolean
null
Whether to add item on tab key press.
optionsunknown[]
null
An array of options to display in dropdown.
optionKeystring
null
Unique key for each option.
optionLabelstring
null
Label field for each option.
optionValuestring
null
Value field for each option.
optionDisabledstring
null
Field to check if an option is disabled.
optionGroupLabelstring
null
Label field for option groups.
optionGroupChildrenstring
null
Field that contains the children options in a group.
delaynumber
null
Delay between keystrokes to wait before sending a query.
minLengthnumber
null
Minimum number of characters to initiate a search.
appendToHTMLElement | "body" | "self"
null
A valid query selector or an HTMLElement to specify where the overlay gets attached.
onAdd(event: useInputTagsAddEvent) => void
null
Callback to invoke when a item is added.
onRemove(event: useInputTagsRemoveEvent) => void
null
Callback to invoke when a item is removed.
onInputValueChange(event: useInputTagsInputValueChangeEvent) => void
null
Callback when the input value changes.
onComplete(event: useInputTagsCompleteEvent) => void
null
Callback to invoke to search for suggestions.
onOpenChange(event: useInputTagsOpenChangeEvent) => void
null
Callback to invoke when the open state changes.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in InputTags component.

nametypedefaultdescription
valuestring[]
null
Current items value.
inputValuestring
null
Current input field value.
focusedItemIndexnumber
null
Index of the currently focused item item (-1 if none).
openedboolean
null
Whether the overlay is open.
searchingboolean
null
Whether a search is in progress.
focusedboolean
null
Whether the input is focused.
focusedOptionIndexnumber
null
The index of the currently focused option. -1 if no option is focused.

Exposes#

Defines the methods and properties exposed by InputTags component.

nametypedefaultdescription
stateuseInputTagsState
null
Current state of the component.
listboxuseListboxInstance
null
The listbox instance used internally for option management.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Reference to the input element.
portalRefRefObject<{ containerRef: { current: { elementRef: RefObject<HTMLDivElement> } } }>
null
Reference to the portal element.
itemRefsRefObject<Map<number, HTMLElement>>
null
Map of item refs by index.
onClick() => void
null
Click handler for the container.
onChange(event: ChangeEvent<HTMLInputElement>) => void
null
Input change handler.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void
null
Keyboard event handler for navigation.
onPaste(event: ClipboardEvent<HTMLInputElement>) => void
null
Paste event handler.
onBlur(event: FocusEvent<HTMLInputElement>) => void
null
Blur event handler.
onFocus(event: FocusEvent<HTMLInputElement>) => void
null
Focus event handler.
onItemRemoveClick(index: number) => void
null
Remove icon click handler.
onRemoveAllItems() => void
null
Removes all items.
changeVisibleState(isVisible: boolean) => void
null
Changes the visibility state of the overlay.
onOverlayEnter() => void
null
Callback when the overlay enters.
onOverlayAfterEnter() => void
null
Callback after the overlay has entered.
getFocusedOptionId() => string
null
Returns the ID of the currently focused option.

Events#

Event fired when the inputtags's value changes.

nametypedescription
valuestring[]Value of the inputtags.

Event object for the onOpenChange callback.

nametypedescription
valuebooleanThe new value of the input tags overlay's open state.

Interfaces#

Defines passthrough(pt) options of InputTags component.

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

Types#

Instance of InputTags component.

values
ComponentInstance<InputTagsRootProps, InputTagsRootState, InputTagsRootExposes>

InputTagsInput#

Props#

Defines valid properties in InputTagsInput component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsInputInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsInputInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsInputPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsInputInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsInput component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
Instance of the InputTags component.

Interfaces#

Defines passthrough(pt) options of InputTagsInput component.

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

Types#

Instance of InputTagsInput component.

values
ComponentInstance<InputTagsInputProps, InputTagsInputState, InputTagsInputExposes>

InputTagsItem#

Props#

Defines valid properties in InputTagsItem component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsItemInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsItemInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsItemPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsItemInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsItem component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
Instance of the InputTags component.

Interfaces#

Defines passthrough(pt) options of InputTagsItem component.

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

Types#

Instance of InputTagsItem component.

values
ComponentInstance<InputTagsItemProps, InputTagsItemState, InputTagsItemExposes>

InputTagsPortal#

Props#

Defines valid properties in InputTagsPortal component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsPortalInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsPortalInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsPortalPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsPortalInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsPortal component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
The InputTags component instance.

Interfaces#

Defines passthrough(pt) options of InputTagsPortal component.

nametypedefaultdescription
rootInputTagsPortalPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
panelInputTagsPortalPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the panel's DOM element.

Types#

Instance of InputTagsPortal component.

values
ComponentInstance<InputTagsPortalProps, InputTagsPortalState, InputTagsPortalExposes>

InputTagsList#

Props#

Defines valid properties in InputTagsList component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsListInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsListInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsListPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsListInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsList component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
The InputTags component instance.

Interfaces#

Defines passthrough(pt) options of InputTagsList component.

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

Types#

Instance of InputTagsList component.

values
ComponentInstance<InputTagsListProps, InputTagsListState, InputTagsListExposes>

InputTagsOptions#

Props#

Defines valid properties in InputTagsOptions component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsOptionsInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsOptionsInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsOptionsPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsOptionsInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsOptions component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
The InputTags component instance.
listboxListboxRootInstance
null
The Listbox component instance.

Interfaces#

Defines passthrough(pt) options of InputTagsOptions component.

nametypedefaultdescription
rootInputTagsOptionsPassThroughType<HTMLAttributes<HTMLUListElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of InputTagsOptions component.

values
ComponentInstance<InputTagsOptionsProps, InputTagsOptionsState, InputTagsOptionsExposes>

InputTagsOption#

Props#

Defines valid properties in InputTagsOption component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsOptionInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsOptionInstance) => string)
null
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>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<InputTagsOptionPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: InputTagsOptionInstance) => ReactNode)
null
The children to render.
optionunknown
null
The option data.
indexnumber
null
The index of the option.
selectedboolean
null
Whether the option is selected.
focusedboolean
null
Whether the option is focused.
disabledboolean
null
Whether the option is disabled.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by InputTagsOption component.

nametypedefaultdescription
inputtagsInputTagsRootInstance
null
The InputTags component instance.
listboxListboxRootInstance
null
The Listbox component instance.
optionInstanceListboxOptionInstance
null
The ListboxOption component instance.
optionunknown
null
The option data object.
indexnumber
null
The index of the option in the list.
groupboolean
null
Whether this option is a group header.
selectedboolean
null
Whether this option is currently selected.

Interfaces#

Defines passthrough(pt) options of InputTagsOption component.

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

Types#

Instance of InputTagsOption component.

values
ComponentInstance<InputTagsOptionProps, InputTagsOptionState, InputTagsOptionExposes>

useInputTags#

Props#

Defines valid properties in useInputTags.

nametypedefaultdescription
valuestring[]
null
Value of the items.
defaultValuestring[]
null
Default value of the items.
inputValuestring
null
Value of the input field (controlled).
defaultInputValuestring
null
Default value of the input field.
openboolean
null
Controlled open state of the input tags overlay.
defaultOpenboolean
null
Default open state for uncontrolled mode.
maxnumber
null
Maximum number of items allowed.
delimiterstring | RegExp
null
Delimiter character or regex to split input into items.
allowDuplicateboolean
null
Whether to allow duplicate items.
addOnBlurboolean
null
Whether to add item on blur event.
addOnPasteboolean
null
Whether to add item on paste event.
addOnTabboolean
null
Whether to add item on tab key press.
optionsunknown[]
null
An array of options to display in dropdown.
optionKeystring
null
Unique key for each option.
optionLabelstring
null
Label field for each option.
optionValuestring
null
Value field for each option.
optionDisabledstring
null
Field to check if an option is disabled.
optionGroupLabelstring
null
Label field for option groups.
optionGroupChildrenstring
null
Field that contains the children options in a group.
delaynumber
null
Delay between keystrokes to wait before sending a query.
minLengthnumber
null
Minimum number of characters to initiate a search.
appendToHTMLElement | "body" | "self"
null
A valid query selector or an HTMLElement to specify where the overlay gets attached.
onValueChange(event: useInputTagsValueChangeEvent) => void
null
Callback to invoke when value changes.
onAdd(event: useInputTagsAddEvent) => void
null
Callback to invoke when a item is added.
onRemove(event: useInputTagsRemoveEvent) => void
null
Callback to invoke when a item is removed.
onInputValueChange(event: useInputTagsInputValueChangeEvent) => void
null
Callback when the input value changes.
onComplete(event: useInputTagsCompleteEvent) => void
null
Callback to invoke to search for suggestions.
onOpenChange(event: useInputTagsOpenChangeEvent) => void
null
Callback to invoke when the open state changes.

State#

Defines valid state in useInputTags.

nametypedefaultdescription
valuestring[]
null
Current items value.
inputValuestring
null
Current input field value.
focusedItemIndexnumber
null
Index of the currently focused item item (-1 if none).
openedboolean
null
Whether the overlay is open.
searchingboolean
null
Whether a search is in progress.
focusedboolean
null
Whether the input is focused.
focusedOptionIndexnumber
null
The index of the currently focused option. -1 if no option is focused.

Exposes#

Defines the methods and properties exposed by useInputTags.

nametypedefaultdescription
stateuseInputTagsState
null
Current state of the component.
listboxuseListboxInstance
null
The listbox instance used internally for option management.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Reference to the input element.
portalRefRefObject<{ containerRef: { current: { elementRef: RefObject<HTMLDivElement> } } }>
null
Reference to the portal element.
itemRefsRefObject<Map<number, HTMLElement>>
null
Map of item refs by index.
onClick() => void
null
Click handler for the container.
onChange(event: ChangeEvent<HTMLInputElement>) => void
null
Input change handler.
onKeyDown(event: KeyboardEvent<HTMLInputElement>) => void
null
Keyboard event handler for navigation.
onPaste(event: ClipboardEvent<HTMLInputElement>) => void
null
Paste event handler.
onBlur(event: FocusEvent<HTMLInputElement>) => void
null
Blur event handler.
onFocus(event: FocusEvent<HTMLInputElement>) => void
null
Focus event handler.
onItemRemoveClick(index: number) => void
null
Remove icon click handler.
onRemoveAllItems() => void
null
Removes all items.
changeVisibleState(isVisible: boolean) => void
null
Changes the visibility state of the overlay.
onOverlayEnter() => void
null
Callback when the overlay enters.
onOverlayAfterEnter() => void
null
Callback after the overlay has entered.
getFocusedOptionId() => string
null
Returns the ID of the currently focused option.

Events#

Custom change event for InputTags component.

nametypedescription
valuestring[]The new value of the items.

Event fired when an item is added.

nametypedescription
valuestringThe added item value.

Event fired when an item is removed.

nametypedescription
valuestringThe removed item value.
indexnumberThe index of the removed item.

Event fired when the input value changes.

nametypedescription
originalEventEThe original event that triggered the change.
querystringThe current input value (query).

Event fired when the autocomplete triggers a search/complete action.

nametypedescription
originalEventEThe original event that triggered the complete.
querystringThe current query string.

Event object for the onOpenChange callback.

nametypedescription
valuebooleanThe new value of the input tags overlay's open state.

Types#

Instance of useInputTags headless.

values
HeadlessInstance<useInputTagsProps, useInputTagsState, useInputTagsExposes>