Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Display

Chip

A compact, static label for categories and workflow details. Chip can use a CSS color seed to create a theme-adaptive colored fill.

Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.

Interactive showcase

In review

Install

Run in your project
bunx --bun @getweini/cli@latest add chip

Start with this example

Import the file copied by the install command, then use Chip for a short, static label. The default example shows the component without customization.

In review
Vue
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'
</script>

<template>
  <Chip>In review</Chip>
</template>

Chip is a static label. Use Badge for a rectangular label, TagsInput for editable strings, or ToggleGroup for selectable filters.

When to use it

Category labels

Label a project, record, or item with a short category name. Use consistent variant meaning across the app, and use text as well as color to carry the meaning.

Workflow context

Place a non-interactive status beside a title or list item when users only need to read it. Chip does not select, dismiss, or perform an action.

More examples

Variants

Compare default, secondary, and destructive variants in default, outline, and ghost modes. Choose a variant consistently instead of assigning meaning by color alone.

default ·defaultsecondary ·defaultdestructive ·default
default ·outlinesecondary ·outlinedestructive ·outline
default ·ghostsecondary ·ghostdestructive ·ghost
Variants
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'

const variants = ['default', 'secondary', 'destructive'] as const
const modes = ['default', 'outline', 'ghost'] as const
</script>

<template>
  <div class="grid gap-3">
    <div v-for="mode in modes" :key="mode" class="flex flex-wrap items-center gap-2">
      <Chip v-for="variant in variants" :key="variant" :variant="variant" :mode="mode">
        {{ variant }} ·{{ mode }}
      </Chip>
    </div>
  </div>
</template>

Custom colors

Seed the tint with a CSS color or the theme's --chart-2 token. The example shows the filled, outline, and ghost treatments; arbitrary colors are not contrast-certified.

Named colorHex colorOKLCH colorTheme tokenOutlineGhost
Custom colors
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'
</script>

<template>
  <div class="flex flex-wrap items-center gap-2">
    <Chip color="blue">Named color</Chip>
    <Chip color="#7c3aed">Hex color</Chip>
    <Chip color="oklch(0.68 0.16 55)">OKLCH color</Chip>
    <Chip color="var(--chart-2)">Theme token</Chip>
    <Chip mode="outline" color="var(--chart-2)">Outline</Chip>
    <Chip mode="ghost" color="var(--chart-2)">Ghost</Chip>
  </div>
</template>

Prefix and suffix

Use the prefix slot for a decorative mark and the suffix slot for useful trailing text. Keep meaningful values, such as a count, available to assistive technology.

Synced 2 min ago Needs review 3 files
Prefix and suffix
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'
</script>

<template>
  <div class="flex flex-wrap items-center gap-2">
    <Chip color="var(--success)">
      <template #prefix>
        <span aria-hidden="true" class="size-1.5 rounded-full bg-current" />
      </template>
      Synced
      <template #suffix>2 min ago</template>
    </Chip>
    <Chip color="var(--warning)">
      <template #prefix><span aria-hidden="true">!</span></template>
      Needs review
      <template #suffix>3 files</template>
    </Chip>
  </div>
</template>

Labels in a list

Compose static labels in a native list row to show project status. The text remains readable when the list wraps on a narrow screen.

  • Atlas redesignIn review
  • Mobile navigationReady
  • Billing updatesBlocked
Labels in a list
<script setup lang="ts">
import Chip from './components/ui/chip/Chip.vue'

const projects = [
  { name: 'Atlas redesign', status: 'In review', color: 'var(--warning)' },
  { name: 'Mobile navigation', status: 'Ready', color: 'var(--success)' },
  { name: 'Billing updates', status: 'Blocked', color: 'var(--destructive)' },
] as const
</script>

<template>
  <ul class="grid min-w-0 gap-2">
    <li
      v-for="project in projects"
      :key="project.name"
      class="flex min-w-0 flex-wrap items-center justify-between gap-2 rounded-md border p-3"
    >
      <span class="min-w-0">{{ project.name }}</span>
      <Chip :color="project.color">{{ project.status }}</Chip>
    </li>
  </ul>
</template>

Complete API

Every public prop, slot, and native span attribute is listed below.

Chip

Complete API for Chip
NameType or signatureDefaultWhat it does
variantprop"default" | "destructive" | "secondary" | undefined"default"Choose the visual treatment for this component.
modeprop"default" | "outline" | "ghost" | undefined"default"Choose the selection or display mode.
colorpropstring | undefinedNot setcolor accepts any CSS color value, including named colors, hex, rgb(),
defaultslot() => unknownRequiredContent shown inside Chip.
prefixslot(() => unknown) | undefinedOptionalContent shown before the main label or value.
suffixslot(() => unknown) | undefinedOptionalContent shown after the main label or value.
Public type definitions
Public types
// packages/frameworks/vue/components/chip/types.ts
import type { chipModes, chipVariants } from './styles'

// ------- TYPES -------

export interface ChipProps {
  variant?: keyof typeof chipVariants
  mode?: keyof typeof chipModes
  color?: string
}


// packages/frameworks/vue/components/chip/styles.ts
// Color meaning and display mode can be changed independently.
export const chipVariants = {
  default: '[--chip-color:var(--primary)]',
  secondary: '[--chip-color:var(--secondary-foreground)]',
  destructive: '[--chip-color:var(--destructive)]',
} as const

export const chipModes = {
  default:
    'border-transparent [background-color:color-mix(in_oklab,var(--chip-color)_18%,var(--card))]',
  outline: 'border-current bg-transparent',
  ghost: 'border-transparent bg-transparent',
} as const

Implementation notes

  • variant selects default, secondary, or destructive; mode independently selects default, outline, or ghost; color accepts a CSS color seed, including a CSS custom property.
  • Chip is a static span with default, prefix, and suffix slots. It does not provide selection, dismissal, or action behavior.
  • Custom colors use color-mix() with theme surface, border, and foreground tokens. Check arbitrary colors in each supported theme; they are not contrast-certified.
  • Use Badge for a rectangular compact label, TagsInput for removable editable strings, and ToggleGroup for selectable filters.

Accessibility and localization

  • Chip has no automatic role, focus behavior, or live-region behavior. Do not present it as a button or selectable filter.
  • Include text with color to communicate a category or status. Mark decorative slot content aria-hidden="true"; leave useful suffix content, including counts, readable to assistive technology.
  • Localize label and count content in the application.

Source contract and editing guidance