Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Tag

tag

Labels content with semantic color, optional icon, and close action.

Usage

Tone color

tone covers the semantic state spectrum: neutral / brand / info / success / warning / danger.

DefaultProcessingExternal browser modeSuccessWarningError
tsx
<>
  <Tag>Default</Tag>
  <Tag tone="brand">Processing</Tag>
  <Tag tone="info">External browser mode</Tag>
  <Tag tone="success">Success</Tag>
  <Tag tone="warning">Warning</Tag>
  <Tag tone="danger">Error</Tag>
</>

Category colours

tone carries state and color carries category — channels, business lines and file types routinely need a dozen-plus colours that six semantic tones cannot carry. color resolves through semantic token layers, so it follows the theme, and it also accepts any CSS colour.

TikTokXiaohongshuWeChat ChannelsBilibiliKuaishouZhihuCustom colour
tsx
<>
  <Tag color="chart-1">TikTok</Tag>
  <Tag color="chart-2">Xiaohongshu</Tag>
  <Tag color="chart-3">WeChat Channels</Tag>
  <Tag color="chart-4">Bilibili</Tag>
  <Tag color="chart-5">Kuaishou</Tag>
  <Tag color="chart-6">Zhihu</Tag>
  <Tag color="#ec4899">Custom colour</Tag>
</>

Variants

variant provides soft (default light background) / solid background / outline stroke.

softsolidoutline
tsx
<>
  <Tag variant="soft" tone="brand">soft</Tag>
  <Tag variant="solid" tone="brand">solid</Tag>
  <Tag variant="outline" tone="brand">outline</Tag>
</>

Status Dot

dot leading status point; pulse lets the point breathe and flash to express the ongoing status.

RunningDeployingRetrying
tsx
<>
  <Tag dot tone="success">Running</Tag>
  <Tag dot pulse tone="brand">Deploying</Tag>
  <Tag dot pulse tone="warning">Retrying</Tag>
</>

With icon

icon slot puts the leading icon (dot is not rendered when it exists).

PassedRejected
tsx
<>
  <Tag tone="success" icon={<CircleCheck />}>Passed</Tag>
  <Tag tone="danger" icon={<CircleX />}>Rejected</Tag>
</>

Dismissible

Pass onClose to render the close button. Click to trigger the callback to remove the label by the caller.

Removable
tsx
<Tag tone="brand" onClose={() => remove(tag)}>
  Removable
</Tag>

Pill shape and clickable tags

shape="pill" is fully round; render turns the tag into a link with a focus ring and hover feedback, for clickable tags such as a version linking to the changelog.

v0.44.012
tsx
<Tag variant="outline" size="sm" shape="pill" render={<a href="/changelog" />}>
  v0.44.0
</Tag>

When to use

Use Tag for a compact read-only state or category such as running, pending review, or rejected. Use [[Badge]] for counts or Chip for removable filter tokens.

Import

ts
import { Tag, tagVariants } from "@hulianui/ui"

Props

NameTypeDefaultDescription
variant"soft" | "solid" | "outline""soft"Visual style. See Surface recipes for the fill and text colour of each step.
tone"neutral" | "brand" | "info" | "success" | "warning" | "danger""neutral"Semantic tone. Same value set as Alert.
colorstring-Category colour: channel, business line, file type — "which kind is this", independent of state (see Semantic tone vs category colour). Accepts semantic names (chart-2, primary, …), any CSS colour, or var(--color-*), through the same resolver as [[Dot]]'s and [[Brand]]'s color. Wins over tone when both are set.
size"sm" | "md""md"Size.
dotbooleanfalseLeading tone-colored dot.
pulsebooleanfalseDot breathing animation, effective only with dot.
isDisabledbooleanfalseLowers opacity and disables pointer actions.
shape"rounded" | "pill""rounded"rounded has small corners; pill is fully rounded (short labels such as versions or counts).
renderReactElement-Renders as a custom element (<a href> or a framework router link) for clickable tags, such as a version linking to the changelog or a tag linking to a filtered page. Styling merges into the element and adds a focus ring and hover feedback, following the Button / Link render contract. Don't combine it with onClose: a button inside a link is an invalid nesting.
classNamestring-Root class.
…HTMLAttributesHTMLAttributes<HTMLSpanElement>-Native span attributes are forwarded. Status tags commonly need title to reveal the full value on hover (a cell showing "Word" whose title is the complete MIME type), plus data-testid and aria-*.

Events

EventTypeDescription
onClose() => voidAdds a close button and reports activation.

Slots

SlotTypeDescription
iconReactNodeLeading icon, taking precedence over dot.
childrenReactNodeTag text.

Surface recipes

When you build a semantic highlight of your own (not a Tag, not an Alert, just a block you assemble), follow this table. It is the recipe this component uses internally:

StepFillText
solidbg-warningtext-warning-foreground
softbg-warning-subtle (or bg-warning/12)text-warning
outlineborder-warningtext-warning

-foreground only matches a solid fill: in light mode it is plain white. Reaching for text-warning-foreground on a tint by naming intuition gives you white on white and the text disappears, while dark mode looks right, because -foreground is near-black there, so whoever develops in dark mode never sees it. On a tint the text colour is always the semantic colour itself.

Semantic tone vs category colour

  • tone is the semantic axis: six state colours shared across the library, answering "what state is this in" — success, warning, error, in progress, neutral note, related to the primary action.
  • color is the category axis: answering "which kind is this", independent of state. Channels, business lines, file types and tagging systems routinely need a dozen-plus colours; six semantic tones cannot carry them, and forcing a mapping makes "success" and "channel A" share one green, so readers reverse-engineering meaning from colour get it wrong.
  • When both are set, color wins (tone is the semantic shortcut). Category colours follow the theme too: soft is a 12% mix, outline is a stroke, solid is a fill — no per-colour light/dark pair required.
  • Very light category colours (amber chart-3, for instance) use primary-foreground as the solid foreground, where white text is weak — prefer soft or outline for those.

Usage notes

  • brand and info are not the same thing (#232). brand is the primary color and means "this relates to the product or the primary action"; info uses its own info color and means "this is a neutral statement of fact, just read it". Reach for info when a tag states which mode something is in, neither a success nor a warning. brand makes an unclickable tag compete with the primary call to action, while neutral blends into every other grey tag on the screen. The two were literally the same color before tokens 0.8.0 added --color-info; see the same history in Alert.
  • color is not a seventh semantic tone. Keep using tone for state; writing "success" as color="chart-2" turns a semantic into a series colour, and the meaning drifts when the theme changes.
  • Pulse requires dot. Icon and dot are mutually exclusive, with icon winning.
  • Closing is controlled by the parent; filter the item from state.
  • The close control's accessible label follows ConfigProvider: zhCN uses "\u79fb\u9664" and enUS uses “Remove”. Legacy custom locales without components.tag keep the Chinese fallback.

Related

Sparkline · ImageViewer · LiveProductCard · DiffStat · ScoreRing · Badge

Playground

Status Label
<Tag dot>Status Label</Tag>
PreviousCouponData DisplayNextAnnotation

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Surface recipes
    • Semantic tone vs category colour
    • Usage notes
    • Related
  • Playground