Chip VChip displays a tag, status or filter. It can be a button, link, selectable toggle or dismissible item.
Usage Design system
<script setup lang="ts">
import { VChip } from 'vectis-ui'
</script>
<template>
<VChip>Design system</VChip>
</template> Examples Variants and tones Combine variant and tone to set the appearance.
neutral soft neutral solid neutral outline
accent soft accent solid accent outline
success soft success solid success outline
warning soft warning solid warning outline
danger soft danger solid danger outline
<script setup lang="ts">
import { VChip } from 'vectis-ui'
const variants = ['soft', 'solid', 'outline'] as const
const tones = ['neutral', 'accent', 'success', 'warning', 'danger'] as const
</script>
<template>
<div v-for="tone in tones" :key="tone" class="row">
<VChip v-for="variant in variants" :key="variant" :variant="variant" :tone="tone">
{{ tone }} {{ variant }}
</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style> Shapes shape selects rounded corners or a pill. Customize the chip radius with --vectis-radius-chip.
chip soft chip solid chip outline
pill soft pill solid pill outline
<script setup lang="ts">
import { VChip } from 'vectis-ui'
const variants = ['soft', 'solid', 'outline'] as const
const shapes = ['chip', 'pill'] as const
</script>
<template>
<div v-for="shape in shapes" :key="shape" class="row">
<VChip
v-for="variant in variants"
:key="variant"
:shape="shape"
:variant="variant"
tone="accent"
>
{{ shape }} {{ variant }}
</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style> Sizes size sets the chip size.
<script setup lang="ts">
import { VChip } from 'vectis-ui'
</script>
<template>
<div class="row">
<VChip size="xs">Extra small</VChip>
<VChip size="sm">Small</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--vectis-space-2);
}
</style> Custom colours color overrides the tone with a CSS colour. Check text contrast for solid chips.
soft solid outline selectable#0f766e mediumvioletred oklch(0.55 0.15 150)
<script setup lang="ts">
import { ref } from 'vue'
import { VChip } from 'vectis-ui'
const selected = ref(true)
</script>
<template>
<div class="row">
<VChip color="#7c3aed" variant="soft">soft</VChip>
<VChip color="#7c3aed" variant="solid">solid</VChip>
<VChip color="#7c3aed" variant="outline">outline</VChip>
<VChip v-model:selected="selected" color="#7c3aed" selectable check>selectable</VChip>
</div>
<div class="row">
<VChip color="#0f766e">#0f766e</VChip>
<VChip color="mediumvioletred">mediumvioletred</VChip>
<VChip color="oklch(0.55 0.15 150)">oklch(0.55 0.15 150)</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style> With icons Use icon props or the start and end slots. Give icon-only interactive chips an accessible name.
Start iconEnd icon Both Operational <script setup lang="ts">
import { VChip } from 'vectis-ui'
import { arrow_right_alt as arrowRightAlt, notifications, schedule } from 'vectis-ui/icons'
</script>
<template>
<VChip :icon-start="schedule" tone="accent">Start icon</VChip>
<VChip :icon-end="arrowRightAlt" tone="accent">End icon</VChip>
<VChip :icon-start="schedule" :icon-end="arrowRightAlt" tone="accent">Both</VChip>
<VChip :icon-start="notifications" tone="danger" clickable aria-label="Notifications" />
<VChip tone="success">
<template #start><span class="dot" /></template>
Operational
</VChip>
</template>
<style scoped>
/* Use currentcolor so the custom dot follows the chip tone. */
.dot {
inline-size: 0.5rem;
aspect-ratio: 1;
border-radius: 50%;
background: currentcolor;
}
</style> Clickable and links clickable renders a button; href renders a link. Without either, the chip is plain content.
<script setup lang="ts">
import { ref } from 'vue'
import { VChip } from 'vectis-ui'
import { arrow_right_alt as arrowRightAlt } from 'vectis-ui/icons'
const count = ref(0)
</script>
<template>
<VChip>Static, no hover</VChip>
<VChip clickable tone="accent" @click="count += 1">Clicked {{ count }} times</VChip>
<VChip :icon-end="arrowRightAlt" href="https://vuejs.org" target="_blank" rel="noreferrer">
vuejs.org
</VChip>
</template> Selection Enable selectable and bind v-model:selected. check displays a tick instead of the start icon when selected.
Vue React Svelte
Open Assigned to meArchived <script setup lang="ts">
import { ref } from 'vue'
import { VChip } from 'vectis-ui'
import { check_circle as checkCircle } from 'vectis-ui/icons'
const frameworks = ref([
{ label: 'Vue', on: true },
{ label: 'React', on: false },
{ label: 'Svelte', on: false },
])
const filters = ref([
{ label: 'Open', on: true },
{ label: 'Assigned to me', on: true },
{ label: 'Archived', on: false },
])
const labels = ref([
{ label: 'Bug', on: true },
{ label: 'Feature', on: false },
{ label: 'Docs', on: false },
])
</script>
<template>
<div class="row" role="group" aria-label="Frameworks">
<VChip
v-for="framework in frameworks"
:key="framework.label"
v-model:selected="framework.on"
selectable
tone="accent"
>
{{ framework.label }}
</VChip>
</div>
<div class="row" role="group" aria-label="Filters">
<VChip
v-for="filter in filters"
:key="filter.label"
v-model:selected="filter.on"
selectable
check
tone="accent"
>
{{ filter.label }}
</VChip>
</div>
<div class="row" role="group" aria-label="Labels">
<VChip
v-for="item in labels"
:key="item.label"
v-model:selected="item.on"
selectable
check
:check-icon="checkCircle"
tone="accent"
>
{{ item.label }}
</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style> Dismissible dismissible adds a button emitting dismiss. Remove the chip yourself. Give each button a dismissLabel naming the item it removes.
<script setup lang="ts">
import { ref } from 'vue'
import { VButton, VChip } from 'vectis-ui'
const ALL = ['Vue', 'TypeScript', 'CSS', 'Vite']
const tags = ref([...ALL])
function remove(tag: string) {
tags.value = tags.value.filter((current) => current !== tag)
}
</script>
<template>
<div class="row">
<VChip v-for="tag in tags" :key="tag" tone="accent" dismissible @dismiss="remove(tag)">
{{ tag }}
</VChip>
<VButton
v-if="tags.length < ALL.length"
variant="ghost"
tone="neutral"
size="xs"
@click="tags = [...ALL]"
>
Reset
</VButton>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--vectis-space-2);
}
</style> States disabled prevents interaction. Disabled links lose their destination and leave the tab order.
<script setup lang="ts">
import { VChip } from 'vectis-ui'
const variants = ['soft', 'solid', 'outline'] as const
</script>
<template>
<div class="row">
<VChip v-for="variant in variants" :key="variant" :variant="variant" tone="accent" disabled>
{{ variant }}
</VChip>
</div>
<div class="row">
<VChip clickable disabled>Clickable</VChip>
<VChip href="https://vuejs.org" disabled>Inert link</VChip>
<VChip selectable check :selected="true" tone="accent" disabled>Selected</VChip>
<VChip dismissible disabled>Dismissible</VChip>
</div>
</template>
<style scoped>
.row {
display: flex;
flex-wrap: wrap;
gap: var(--vectis-space-2);
}
</style> Router VChip renders a real <a> when href is set. With Nuxt or Vue Router, render it inside the router link in custom mode and pass on href and navigate. A click with a modifier key still opens a new tab.
<RouterLink v-slot="{ href, navigate }" to="/settings" custom>
<VChip :href="href" @click="navigate">Settings</VChip>
</RouterLink> API Props Events Slots Types Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
} export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string } export type IconSource = string | BuiltinIcon | IconRender