Skip to content
Accessibility: Work in progress
Translations: Not Needed

Input Tag

A component for inputting and managing multiple tags

Basic Usage

To create a new tag, type text into the input field and press Enter. Pressing Backspace will remove the most recently added tag.

Type and press Enter to create a tag

Vue
html
<template>
  <HLInputTag placeholder="Type and press Enter to create a tag" />
</template>

<script setup lang="ts">
  import { HLInputTag } from '@platform-ui/highrise'
</script>

Sizes

Large size

Medium size

Small size

Extra small size

2x Extra small size

3x Extra small size

Vue
html
<template>
  <HLInputTag size="lg" placeholder="Large size" />
  <HLInputTag size="md" placeholder="Medium size" />
  <HLInputTag size="sm" placeholder="Small size" />
  <HLInputTag size="xs" placeholder="Extra small size" />
  <HLInputTag size="2xs" placeholder="2x Extra small size" />
  <HLInputTag size="3xs" placeholder="3x Extra small size" />
</template>
<script setup lang="ts">
  import { HLInputTag } from '@platform-ui/highrise'
</script>

With Prefix and Suffix

$
INR
Vue
html
<template>
  <HLInputTag>
    <template #prefix>$</template>
    <template #suffix>INR</template>
  </HLInputTag>
</template>
<script setup lang="ts">
  import { HLInputTag } from '@platform-ui/highrise'
</script>

Disabled State

Vue
html
<template>
  <HLInputTag disabled />
</template>
<script setup lang="ts">
  import { HLInputTag } from '@platform-ui/highrise'
</script>

With Input Group

http://
Vue
html
<template>
  <HLInputGroup>
    <HLInputGroupLabel>http://</HLInputGroupLabel>
    <HLInputTag />
  </HLInputGroup>
</template>
<script setup lang="ts">
  import { HLInputGroup, HLInputGroupLabel, HLInputTag } from '@platform-ui/highrise'
</script>

Tag Overflow Behavior

When there are too many tags to fit in the container, they are automatically hidden and shown in a "+n" counter. Hovering over the counter reveals all hidden tags in a tooltip.

Tag 1
Tag 2
Tag 3
Tag 4
Tag 5
Tag 6
Tag 7
Tag 8
Tag 9
Tag 10
Tag 11
Tag 12
Tag 13
Tag 14
Tag 15
Tag 16
Tag 17
Tag 18
Tag 19
Tag 20
Vue
html
<template>
  <HLInputTag :value="tags" @update:overflow="handleOverflow" />
</template>

<script setup lang="ts">
  import { HLInputTag } from '@platform-ui/highrise'
  import { ref } from 'vue'
  const tags = ref(['Tag 1', 'Tag 2', 'Tag 3', 'Tag 4', 'Tag 5', 'Tag 6', 'Tag 7'])

  function handleOverflow(overflow: boolean) {
    console.log('Tags are overflowing:', overflow)
  }
</script>

Allow Spaces in Tags

By default, spaces are not allowed in tags. Set allowSpaces to true to enable spaces within tags.

Spaces allowed in tags

Vue
html
<HLInputTag :allowSpaces="true" placeholder="Spaces allowed in tags" />

Loading State

Display a loading indicator while processing tag-related operations.

Loading Tags...
Vue
html
<HLInputTag :loading="true" :value="['Loading Tags...']" />

Tag Truncation

When tags have long labels, you can enable truncation to prevent them from overflowing their container. This is particularly useful when dealing with lengthy tag names.

Very Long Tag Name That Should Be Truncated
Another Extremely Long Tag Label
Short Tag
Yet Another Long Tag Name That Exceeds The Container Width
Vue
html
<template>
  <HLInputTag :value="longTags" :truncate="true" :max-width="120" placeholder="Type to add truncated tags" />
</template>
<script setup>
  import { HLInputTag } from '@platform-ui/highrise'

  const longTags = ref([
    'Very Long Tag Name That Should Be Truncated',
    'Another Extremely Long Tag Label',
    'Short Tag',
    'Yet Another Long Tag Name That Exceeds The Container Width',
  ])
</script>

Imports

ts
import { HLInputTag } from '@platform-ui/highrise'

Props

NameTypeDefaultDescription
id *string | undefinedundefinedUnique identifier for the input tag
placeholderstring'Start typing...'Placeholder text when no tags are present
size'lg' | 'md' | 'sm' | 'xs' | '2xs' | '3xs''sm'Size of the input tag
disabledbooleanfalseWhether the input tag is disabled
autofocusbooleanfalseWhether to focus the input automatically
loadingbooleanfalseWhether to show loading state
allowSpacesbooleanfalseWhether to allow spaces in tags
valuestring[] | undefinedundefinedArray of tag values
truncatebooleanfalseWhether to truncate tag text with ellipsis
maxWidthstring | number136Maximum width for truncated tags (in pixels if number, or CSS units if string)

Emits

NameParametersDescription
@input(event: Event)Triggered on input
@input:blur(event: Event)Triggered when input loses focus
@input:focus(event: Event)Triggered when input gains focus
@update:value(value: string[])Triggered when tags array is updated
@click({ event: Event, index: number })Triggered when a tag is clicked
@close({ event: Event, index: number })Triggered when a tag's close button is clicked
@update:count(count: number)Triggered when hidden tags count changes
@update:counter(count: number)Triggered when visible counter value changes
@update:overflow(overflow: boolean)Triggered when tags overflow container

Slots

NameDescription
prefixContent to show before the input
suffixContent to show after the input

Key Interactions

KeyAction
EnterCreates a new tag from the current input value
BackspaceDeletes the last tag when input is empty
EscapeBlurs the input field