Tag

free

Tag labels content with a compact keyword, category, or status marker.

LabelLabel
import Tag from '@/components/ui/tag';

export default function UsageDemo() {
  return (

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Tag

Examples

Basic

DraftDesignEngineeringResearch
import Tag from '@/components/ui/tag';

export default function BasicDemo() {
  return (

Sizes

SmallMediumLarge
import Tag from '@/components/ui/tag';

export default function SizesDemo() {
  return (

Affix

Default dotCustom dotPrefix iconSuffix icon
import Tag from '@/components/ui/tag';
import { PiHash, PiPlus } from 'react-icons/pi'

export default function AffixDemo() {

Status

ActiveDraftPendingFailed
import Tag from '@/components/ui/tag';

export default function StatusDemo() {
  return (

Colors

EmeraldRoseBlueCyanOrangeRedPurpleYellow
import Tag from '@/components/ui/tag';

export default function CategoryDemo() {
  return (

Removable

In stockFree shippingUnder $50On sale
import { useState } from 'react';
import Tag from '@/components/ui/tag';
import CloseButton from '@/components/ui/close-button';

API

Tag renders a span and accepts the props below plus native props for that element.

PropDescriptionTypeDefault
childrenContent shown inside the tag.ReactNode-
sizeControls padding and text size.ControlSize'md'
prefixContent before the label. Pass true for a colored dot, or a node to render it directly.boolean | ReactNodefalse
prefixClassExtra classes for the prefix dot. Applies only when prefix is true.string-
suffixContent after the label. Pass true for a colored dot, or a node to render it directly.boolean | ReactNodefalse
suffixClassExtra classes for the suffix dot. Applies only when suffix is true.string-
classNameExtra classes for the root span.string-
refRef forwarded to the root span.Ref<HTMLSpanElement>-
...nativeSpanPropsNative props for the root span.NativeTagSpanProps-

Types

type ControlSize = 'sm' | 'md' | 'lg';
type NativeTagSpanProps = Omit<ComponentPropsWithRef<'div'>, 'prefix'>;