Tags Input
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
TagsInput
import { TagsInput } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
modelValue | AcceptableInputValue[] | null | undefined | — | The controlled value of the tags input. Can be bind as v-model. |
defaultValue | AcceptableInputValue[] | undefined | — | The value of the tags that should be added. Use when you do not need to control the state of the tags input |
addOnPaste | boolean | undefined | — | When true, allow adding tags on paste. Work in conjunction with delimiter prop. |
addOnTab | boolean | undefined | — | When true allow adding tags on tab keydown |
addOnBlur | boolean | undefined | — | When true allow adding tags blur input |
duplicate | boolean | undefined | — | When true, allow duplicated tags. |
disabled | boolean | undefined | — | When true, prevents the user from interacting with the tags input. |
delimiter | string | RegExp | undefined | — | The character or regular expression to trigger the addition of a new tag. Also used to split tags for @paste event |
dir | Direction | undefined | — | The reading direction of the combobox when applicable. <br> If omitted, inherits globally from ConfigProvider or assumes LTR (left-to-right) reading mode. |
max | number | undefined | — | Maximum number of tags. |
id | string | undefined | — | — |
convertValue | ((value: string) => AcceptableInputValue) | undefined | — | Convert the input value to the desired type. Mandatory when using objects as values and using TagsInputInput |
displayValue | ((value: AcceptableInputValue) => string) | undefined | — | Display the value of the tag. Useful when you want to apply modifications to the value like adding a suffix or when using object as values |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
name | string | undefined | — | The name of the field. Submitted with its owning form as part of a name/value pair. |
required | boolean | undefined | — | When true, indicates that the user must set the value before the owning form can be submitted. |
Events
| Name | Type | Required / default | Description |
|---|---|---|---|
update:modelValue | [payload: AcceptableInputValue[]] | — | — |
invalid | [payload: AcceptableInputValue] | — | — |
addTag | [payload: AcceptableInputValue] | — | — |
removeTag | [payload: AcceptableInputValue] | — | — |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Apple', 'Banana'])
return { tags }
},
template: `
<TagsInput v-model="tags" class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add a fruit..." />
</TagsInput>
`,
}),
}
WithMax
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
name: 'With Max',
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Vue', 'Laravel'])
return { tags }
},
template: `
<div class="grid w-full max-w-sm gap-1.5">
<TagsInput v-model="tags" :max="3">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add up to 3 tags..." />
</TagsInput>
<p class="text-sm text-muted-foreground">{{ tags.length }}/3 tags</p>
</div>
`,
}),
}
Disabled
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Read-only', 'Locked'])
return { tags }
},
template: `
<TagsInput v-model="tags" disabled class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Disabled..." />
</TagsInput>
`,
}),
}
TagsInputInput
import { TagsInputInput } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
placeholder | string | undefined | — | The placeholder character to use for empty tags input. |
autoFocus | boolean | undefined | — | Focus on element when mounted. |
maxLength | number | undefined | — | Maximum number of character allowed. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Apple', 'Banana'])
return { tags }
},
template: `
<TagsInput v-model="tags" class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add a fruit..." />
</TagsInput>
`,
}),
}
WithMax
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
name: 'With Max',
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Vue', 'Laravel'])
return { tags }
},
template: `
<div class="grid w-full max-w-sm gap-1.5">
<TagsInput v-model="tags" :max="3">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add up to 3 tags..." />
</TagsInput>
<p class="text-sm text-muted-foreground">{{ tags.length }}/3 tags</p>
</div>
`,
}),
}
Disabled
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Read-only', 'Locked'])
return { tags }
},
template: `
<TagsInput v-model="tags" disabled class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Disabled..." />
</TagsInput>
`,
}),
}
TagsInputItem
import { TagsInputItem } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
value | AcceptableInputValue | Required | Value associated with the tags |
disabled | boolean | undefined | — | When true, prevents the user from interacting with the tags input. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Apple', 'Banana'])
return { tags }
},
template: `
<TagsInput v-model="tags" class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add a fruit..." />
</TagsInput>
`,
}),
}
WithMax
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
name: 'With Max',
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Vue', 'Laravel'])
return { tags }
},
template: `
<div class="grid w-full max-w-sm gap-1.5">
<TagsInput v-model="tags" :max="3">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add up to 3 tags..." />
</TagsInput>
<p class="text-sm text-muted-foreground">{{ tags.length }}/3 tags</p>
</div>
`,
}),
}
Disabled
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Read-only', 'Locked'])
return { tags }
},
template: `
<TagsInput v-model="tags" disabled class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Disabled..." />
</TagsInput>
`,
}),
}
TagsInputItemDelete
import { TagsInputItemDelete } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
default | {} | — | — |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Apple', 'Banana'])
return { tags }
},
template: `
<TagsInput v-model="tags" class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add a fruit..." />
</TagsInput>
`,
}),
}
WithMax
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
name: 'With Max',
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Vue', 'Laravel'])
return { tags }
},
template: `
<div class="grid w-full max-w-sm gap-1.5">
<TagsInput v-model="tags" :max="3">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add up to 3 tags..." />
</TagsInput>
<p class="text-sm text-muted-foreground">{{ tags.length }}/3 tags</p>
</div>
`,
}),
}
Disabled
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Read-only', 'Locked'])
return { tags }
},
template: `
<TagsInput v-model="tags" disabled class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Disabled..." />
</TagsInput>
`,
}),
}
TagsInputItemText
import { TagsInputItemText } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
Examples
These are authored Storybook examples. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Apple', 'Banana'])
return { tags }
},
template: `
<TagsInput v-model="tags" class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add a fruit..." />
</TagsInput>
`,
}),
}
WithMax
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
name: 'With Max',
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Vue', 'Laravel'])
return { tags }
},
template: `
<div class="grid w-full max-w-sm gap-1.5">
<TagsInput v-model="tags" :max="3">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Add up to 3 tags..." />
</TagsInput>
<p class="text-sm text-muted-foreground">{{ tags.length }}/3 tags</p>
</div>
`,
}),
}
Disabled
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import {
TagsInput,
TagsInputInput,
TagsInputItem,
TagsInputItemDelete,
TagsInputItemText,
} from '.'
import { Label } from '../label'
{
render: () => ({
components: { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText },
setup() {
const tags = ref(['Read-only', 'Locked'])
return { tags }
},
template: `
<TagsInput v-model="tags" disabled class="w-full max-w-sm">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput placeholder="Disabled..." />
</TagsInput>
`,
}),
}