InputTags API

API documentation for InputTags component

InputTags#

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?: InputTagsInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsInstance) => 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<InputTagsPassThrough>
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: InputTagsInstance) => 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: InputTagsValueChangeEvent) => void
null
Callback fired when the inputtags's value changes.
defaultValuestring[]
null
Default value of the items.
valuestring[]
null
Value of the items.
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.
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.
[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).

Exposes#

Defines the methods and properties exposed by InputTags component.

nametypedefaultdescription
stateuseInputTagsState
null
Current state of the component.
controlRefRefObject<HTMLDivElement>
null
Reference to the control element.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Reference to the input 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.
onItemRemoveClick(index: number) => void
null
Remove icon click handler.
onRemoveAllItems() => void
null
Removes all items.

Interfaces#

Defines passthrough(pt) options of InputTags component.

nametypedefaultdescription
rootInputTagsPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
itemInputTagsPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the item's DOM element.
pcInputTextInputTagsPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the input's DOM element.
hiddenInputInputTagsPassThroughType<InputHTMLAttributes<HTMLInputElement>>
null
Used to pass attributes to the hidden input's DOM element.

Types#

Instance of InputTags component.

values
ComponentInstance<InputTagsProps, InputTagsState, InputTagsExposes>

InputTagsInput#

Props#

Defines valid properties in InputTagsInputcomponent.

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 InputTagsInputcomponent.

nametypedefaultdescription
inputtagsInputTagsInstance
null
Instance of the InputTags component.

Interfaces#

Defines passthrough(pt) options of InputTagsInputcomponent.

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

Types#

Instance of InputTagsInputcomponent.

values
ComponentInstance<InputTagsInputProps, InputTagsInputState, InputTagsInputExposes>

InputTagsItem#

Props#

Defines valid properties in InputTagsItemcomponent.

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 InputTagsItemcomponent.

nametypedefaultdescription
inputtagsInputTagsInstance
null
Instance of the InputTags component.

Interfaces#

Defines passthrough(pt) options of InputTagsItemcomponent.

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

Types#

Instance of InputTagsItemcomponent.

values
ComponentInstance<InputTagsItemProps, InputTagsItemState, InputTagsItemExposes>

InputTagsHiddenInput#

Props#

Defines valid properties in InputTagsHiddenInputcomponent.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: InputTagsHiddenInputInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: InputTagsHiddenInputInstance) => 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<InputTagsHiddenInputPassThrough>
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: InputTagsHiddenInputInstance) => ReactNode)
null
The children to render.
namestring
null
Name of the hidden input field.
[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 InputTagsHiddenInputcomponent.

nametypedefaultdescription
inputtagsInputTagsInstance
null
Instance of the InputTags component.

Interfaces#

Defines passthrough(pt) options of InputTagsHiddenInputcomponent.

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

Types#

Instance of InputTagsHiddenInputcomponent.

values
ComponentInstance<InputTagsHiddenInputProps, InputTagsHiddenInputState, InputTagsHiddenInputExposes>

useInputTags#

Props#

Defines valid properties in useInputTags.

nametypedefaultdescription
defaultValuestring[]
null
Default value of the items.
valuestring[]
null
Value of the items.
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.
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.

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).

Exposes#

Defines the methods and properties exposed by useInputTags.

nametypedefaultdescription
stateuseInputTagsState
null
Current state of the component.
controlRefRefObject<HTMLDivElement>
null
Reference to the control element.
inputRefRefObject<{ elementRef: RefObject<HTMLInputElement> }>
null
Reference to the input 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.
onItemRemoveClick(index: number) => void
null
Remove icon click handler.
onRemoveAllItems() => void
null
Removes all items.

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.

Types#

Instance of useInputTags headless.

values
HeadlessInstance<useInputTagsProps, useInputTagsState, useInputTagsExposes>