Tags Input
Create and manage a list of tags/chips.
API Reference
An enhanced label component that can be used with any input.
Property | Type | Description |
---|---|---|
value $bindable | string[] | The value of the tags input. An array of tag values/strings. Default: [] |
onValueChange | function | A callback function called when the active accordion item value changes. If the Default: undefined |
controlledValue | boolean | Whether or not the value is controlled or not. If Default: false |
delimiters | string[] | An array of delimiters to use to splitting the input value. Default: [','] |
pasteBehavior | enum | How text is handled when it is pasted into the input. Default: 'add' |
validate | function | A validation function to determine if the individual tag being added/edited is valid. Return Default: undefined |
editable | boolean | Whether or not the individual tags are editable or not. This applies to all tags. If you wish to override a specific tag's editable state, you can use the Default: true |
name | string | If provided, a hidden input element will be rendered for each tag to submit the values with a form. Default: undefined |
required | boolean | Whether or not the hidden input element should be marked as required or not. Default: false |
ref $bindable | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-root | '' | Present on the root element. |
The container for the tags.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-invalid | '' | Present on the list element when the tags input is invalid. |
data-tags-input-list | '' | Present on the list element. |
The container for a single tag within the tags input.
Property | Type | Description |
---|---|---|
value required | string | The value of the tag. Default: undefined |
index required | number | The index of the tag in the value array. Default: undefined |
ref $bindable | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-editing | '' | Present on the tag element when the tag is being edited. |
data-invalid | '' | Present on the tag element when the tags input is marked as invalid. |
The container for the tag content, which typically includes the tag text and edit/remove buttons and does not include the edit input.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-tag-content | '' |
The text content of the tag.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLSpanElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-tag-text | '' | Present on the text element. |
The remove button for the tag.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLButtonElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-tag-remove | '' | Present on the remove element. |
The edit button for the tag.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLButtonElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-tag-edit | '' | Present on the edit element. |
data-invalid | '' | Present on the edit element when the tags input is marked as invalid. |
The input field for the tags input.
Property | Type | Description |
---|---|---|
blurBehavior | enum | The behavior to use when the input is blurred with text in it. Default: 'none' |
value $bindable | string | The value of the input. Default: undefined |
onValueChange | function | A callback function called when the value of the input changes. Default: undefined |
controlledValue | boolean | Whether or not the value is controlled or not. If Default: false |
ref $bindable | HTMLInputElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-invalid | '' | Present on the input element when the tags input is marked as invalid. |
data-tags-input-input | '' | Present on the input element. |
The clear button for the tags input.
Property | Type | Description |
---|---|---|
ref $bindable | HTMLButtonElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See Child Snippet docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-tags-input-clear | '' | Present on the clear element. |