Tag
Atomic tag element
Default
Your text here
html
<template>
<HLTag id="example-tag" size="small" color="gray">Your text here</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
</script>
All Sizes
55.55K
55.55K
55.55K
55.55K
html
<template>
<HLTag id="size-xs-tag" closable size="xs" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
html
<template>
<HLTag id="size-sm-tag" closable size="sm" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
html
<template>
<HLTag id="size-md-tag" closable size="md" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
html
<template>
<HLTag id="size-lg-tag" closable size="lg" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
With Checkbox
55.55K
html
<template>
<HLTag id="checkbox-tag" @checked="onChecked" v-model:checked="isChecked" checkbox size="sm" :count="55555"> Label </HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
Closable
Event @close
will be triggered when the close icon is clicked.
Label 1
55.55K
disabled
55.55K
html
<template>
<HLTag v-if="showTag1" id="closable-tag" closable size="sm" :count="55555" @close="onCloseTag"> Label 1 </HLTag>
<HLTag id="closable-tag1" closable size="sm" :count="55555" disabled> disabled </HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { ref } from 'vue'
const showTag1 = ref(true)
const onCloseTag = () => {
showTag1.value = false
}
</script>
With Close Icon
55.55K
html
<template>
<HLTag id="close-icon-tag" closable size="sm" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
Rounded
55.55K
55.55K
html
<template>
<HLTag id="rounded-tag" closable size="sm" :count="55555" round>
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
Dropdown Type
html
<template>
<HLTag id="dropdown-tag" size="sm" dropdown="open" round>
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
html
<template>
<HLTag id="dropdown-tag" size="sm" dropdown="close" round>
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
</script>
Non-interactive
Non-interactive Tag
Non-interactive Round
html
<!-- Basic non-interactive -->
<HLTag id="non-interactive-tag" size="sm" :interactive="false"> Non-interactive Tag </HLTag>
<!-- Round non-interactive -->
<HLTag id="non-interactive-round-tag" size="sm" :interactive="false" round> Non-interactive Round </HLTag>
<!-- Non-interactive with icon -->
<HLTag id="non-interactive-icon-tag" size="sm" :interactive="false">
<template #icon>
<Lightning01Icon />
</template>
With Icon
</HLTag>
<!-- Round non-interactive with icon -->
<HLTag id="non-interactive-round-icon-tag" size="sm" :interactive="false" round>
<template #icon>
<Lightning01Icon />
</template>
Round with Icon
</HLTag>
Colors - Borderless
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
html
<template>
<HLTag
id="borderless-rose-tag"
:bordered="false"
@checked="onChecked"
v-model:checked="isChecked"
color="rose"
closable
checkbox
size="lg"
:count="55555"
>
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
import { ref } from 'vue'
const isChecked = ref(false)
const onChecked = val => {
isChecked.value = val
}
</script>
Colors - Bordered
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
55.55K
html
<template>
<HLTag id="example-tag" @checked="onChecked" v-model:checked="isChecked" color="rose" closable checkbox size="lg" :count="55555">
<template #icon>
<Lightning01Icon />
</template>
Label
</HLTag>
</template>
<script setup lang="ts">
import { HLTag } from '@platform-ui/highrise'
import { Lightning01Icon } from '@gohighlevel/ghl-icons/24/outline'
const isChecked = ref(false)
const onChecked = val => {
isChecked.value = val
}
</script>
Event Testing
This example shows handling of the @close
and @checked
events. Click on the tag or its close button to see the events being logged.
Interactive Tag
Event Log:
No events logged yet. Try clicking the tag or close button above.
vue
<script setup>
const eventLog = ref([])
const isChecked = ref(false)
const showTag = ref(true)
const handleClose = id => {
eventLog.value.unshift({
event: 'Tag closed',
details: `ID: ${id}`,
timestamp: new Date().toLocaleTimeString(),
})
showTag.value = false
// Keep only last 5 events
if (eventLog.value.length > 5) {
eventLog.value.pop()
}
}
const handleChecked = checked => {
isChecked.value = checked
eventLog.value.unshift({
event: 'Tag checked',
details: `Checked: ${checked}`,
timestamp: new Date().toLocaleTimeString(),
})
// Keep only last 5 events
if (eventLog.value.length > 5) {
eventLog.value.pop()
}
}
const resetTag = () => {
showTag.value = true
isChecked.value = false
eventLog.value.unshift({
event: 'Tag reset',
details: 'Tag restored to initial state',
timestamp: new Date().toLocaleTimeString(),
})
// Keep only last 5 events
if (eventLog.value.length > 5) {
eventLog.value.pop()
}
}
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 1rem;">
<div>
<HLTag v-if="showTag" id="event-test-tag" closable checkbox v-model:checked="isChecked" @close="handleClose" @checked="handleChecked">
Interactive Tag
</HLTag>
<HLTag v-if="!showTag" id="reset-tag" color="blue" @click="resetTag"> Reset Tag </HLTag>
</div>
<div class="text-sm">
<p class="font-bold mb-2">Event Log:</p>
<div v-if="eventLog.length === 0" class="text-gray-500">No events logged yet. Try clicking the tag or close button above.</div>
<div v-for="(log, index) in eventLog" :key="index" class="text-gray-700">
{{ log.timestamp }}: {{ log.event }} - {{ log.details }}
</div>
</div>
</div>
</template>
Imports
ts
import { HLTag } from '@platform-ui/highrise'
Props
Prop | Type | Default | Description |
---|---|---|---|
id * | string | undefined | undefined | Unique identifier for the tag |
size | 'lg' | 'md' | 'sm' | 'xs' | 'sm' | Size of the tag. Must be one of the predefined tag sizes |
color | 'gray' | 'primary' | 'success' | 'error' | 'warning' | 'gray-blue' | 'blue-light' | 'blue' | 'indigo' | 'purple' | 'pink' | 'rose' | 'orange-dark' | 'gray' | Color theme of the tag. Must be one of the predefined tag colors |
bordered | boolean | true | Whether the tag has a border |
checkbox | boolean | undefined | Whether to show a checkbox within the tag |
checked | boolean | undefined | Controls the checked state when using checkbox mode |
closable | boolean | undefined | Whether the tag can be closed/removed |
disabled | boolean | undefined | Whether the tag is disabled |
round | boolean | undefined | Whether the tag has rounded corners |
count | number | undefined | Number to display within the tag. Only positive values are supported. |
avatarProps | HLAvatarProps | undefined | Props to pass to the avatar component when using avatar slot |
dropdown | 'open' | 'close' | false | false | Controls dropdown state. Use 'open' or 'close' to show/hide dropdown icon |
interactive | boolean | true | Whether the tag is clickable. Tags that are closable or have a dropdown or checkbox are always interactive |
Emits
Name | Type | Description |
---|---|---|
@close | (id?: string): void | Emitted when close icon is clicked, returns tag ID |
@checked | (val: boolean): void | Emitted when tag is clicked, returns checked state |
Slots
Name | Parameters | Description |
---|---|---|
default | () | The default content slot |
icon | () | The icon slot inside tag |
avatar | () | The avatar slot inside tag |