Nasimunreleased, after 0.12.0
ComponentsFeedback and states

StatusChip

A status as an icon and words on a soft tint, never colour alone.

Since 0.5.0Server Componentstable
Open alone
status-chip/basic.tsx
import { StatusChip } from '@nyxon/nasim';

// A screen reads its words from its own strings module; an example keeps them at the top.
const copy = { paid: 'پرداخت‌شده' };

export default function Basic() {
  return <StatusChip tone="success" label={copy.paid} />;
}

Import

import { StatusChip } from '@nyxon/nasim';

Usage

StatusChip is plain markup with plain props, so a Server Component can render it; it needs no 'use client'. Pick the tone from what the status means for the reader, and pass the words as label from the screen's own strings module.

<StatusChip tone="success" label={t.invoice.paid} />

Examples

Tones

Five tones: success, warning, danger, info and neutral. Each has its own icon and tint.

Open alone
status-chip/tones.tsx
import { StatusChip, type StatusTone } from '@nyxon/nasim';

// One invoice status per tone. The words carry the meaning; the tint and icon repeat it.
const statuses: { tone: StatusTone; label: string }[] = [
  { tone: 'success', label: 'پرداخت‌شده' },
  { tone: 'warning', label: 'در انتظار تأیید' },
  { tone: 'danger', label: 'ناموفق' },
  { tone: 'info', label: 'در حال بررسی' },
  { tone: 'neutral', label: 'منقضی‌شده' },
];

export default function Tones() {
  return (
    <div className="flex flex-wrap gap-2">
      {statuses.map(({ tone, label }) => (
        <StatusChip key={tone} tone={tone} label={label} />
      ))}
    </div>
  );
}

Long text

A long label wraps inside the chip rather than pushing its column wider. Keep labels short where you can: a status is read at a glance.

Open alone
status-chip/long-text.tsx
import { StatusChip } from '@nyxon/nasim';

const copy = {
  label: 'در انتظار تأیید پرداخت از سوی بانک صادرکنندهٔ کارت',
};

// A long Persian status in a narrow column, as in a table cell on a phone.
export default function LongText() {
  return (
    <div className="max-w-48">
      <StatusChip tone="warning" label={copy.label} />
    </div>
  );
}

Rules

  • The label says the status in words. The tone's colour and icon repeat it; a reader who cannot tell the colours apart, or a screen reader, still gets the whole status.
  • Coloured text always sits on its own soft tint, which holds 4.5:1 in both themes (tokens.test.ts). Do not put a chip's colours on another background.
  • icon replaces the tone's icon with a more specific one (a clock for «waiting», an hourglass for «expired»). It is hidden from screen readers, so the label must still carry the meaning.

Accessibility

The chip is a <span> with no role: it is read in place as text, and it is not focusable. The icon is aria-hidden. It is not a control; an action next to a status is a button of its own.

API

PropTypeDefaultDescription
toneStatusTonerequiredThe tint and the icon. It repeats what label says; it never says it alone.
labelstringrequiredThe status in words, from the screen's strings module: the chip is never colour alone.
size"lg" | "md" | "sm"'md'The chip's height and text size, HeroUI's chip sizes.
iconReactNode—Replaces the tone's icon (a clock for «waiting», an hourglass for «expired»). It is hidden from screen readers.
classNamestring—Classes added to the chip's own (layout only: margins, alignment).

StatusTone is exported too, for a list of statuses typed by tone.

TrendChip (the change against the previous period, on the same tints) and Notice (an inline message, for a status that needs a sentence). Neither has a page here yet.

On this page