Preview Updated 2026-05-10

Tag

Tag — 3 variants, 6 tones, 3 sizes, closable, optional pill radius.

Basic usage

tone controls the semantic color, default neutral (gray). Other options: primary / success / warning / danger / info.

DefaultPrimarySuccessWarningDangerInfo
<script setup lang="ts">
import { CfTag } from '@chufix-design/vue';
</script>

<template>
<CfTag>Default</CfTag>
<CfTag tone="primary">Primary</CfTag>
<CfTag tone="success">Success</CfTag>
<CfTag tone="warning">Warning</CfTag>
<CfTag tone="danger">Danger</CfTag>
<CfTag tone="info">Info</CfTag>
</template>
import { CfTag } from '@chufix-design/react';

export default function Demo() {
return (
  <>
    <CfTag>Default</CfTag>
    <CfTag tone="primary">Primary</CfTag>
    <CfTag tone="success">Success</CfTag>
    <CfTag tone="warning">Warning</CfTag>
    <CfTag tone="danger">Danger</CfTag>
    <CfTag tone="info">Info</CfTag>
  </>
);
}

Variants, sizes, and radius

variant is orthogonal to tone: solid / soft (default) / outline. rounded switches to a pill radius.

solidsoftoutline
solidsoftoutline
smmdlgrounded
<CfTag variant="solid" tone="primary">solid</CfTag>
<CfTag variant="soft" tone="primary">soft</CfTag>
<CfTag variant="outline" tone="primary">outline</CfTag>

<CfTag size="sm" tone="success">sm</CfTag>
<CfTag size="md" tone="success">md</CfTag>
<CfTag size="lg" tone="success">lg</CfTag>
<CfTag tone="success" rounded>rounded</CfTag>
<CfTag variant="solid" tone="primary">solid</CfTag>
<CfTag variant="soft" tone="primary">soft</CfTag>
<CfTag variant="outline" tone="primary">outline</CfTag>

<CfTag size="sm" tone="success">sm</CfTag>
<CfTag size="md" tone="success">md</CfTag>
<CfTag size="lg" tone="success">lg</CfTag>
<CfTag tone="success" rounded>rounded</CfTag>

Closable

Enable closable to show an × button; clicking it fires close / onClose.

VueAstroTailwindTypeScript
<CfTag
v-for="t in tags"
:key="t"
tone="primary"
closable
@close="tags = tags.filter(x => x !== t)"
>{{ t }}</CfTag>
{tags.map((t) => (
<CfTag
  key={t}
  tone="primary"
  closable
  onClose={() => setTags((xs) => xs.filter((x) => x !== t))}
>{t}</CfTag>
))}

API

PropTypeDefaultDescription
variant'solid' | 'soft' | 'outline''soft'Visual variant
tone'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info''neutral'Semantic color
size'sm' | 'md' | 'lg''md'Height and font size
roundedbooleanfalsePill radius
closablebooleanfalseShow × close button

Slots / Children

  • Vue: default slot is the text; leading named slot for an icon.
  • React: children is the text; leading prop for an icon node.

反馈与讨论

Tag · Discussion

0
0 / 600
一键发送
正在加载评论...