Badge
Short label for a state, category, or count.
- ブラウザー
- Chrome 123+Firefox 121+Safari 17.5+
- ティア
- 0
- 圧縮後のサイズ
- 201 B
- 強制レイアウトの上限
- 0 ms
- axe の上限
- 0
- SSR 対応
- はい
- 公開された契約
- テストハーネス
プレイグラウンド
Badge
Ready使用例
Status labels
Use visible words to convey state; color is a supporting cue.
DraftReadyReviewBlocked
import { Badge } from "@gunkin/uiify";
export default function Example() {
return (
<>
<Badge variant="secondary">Draft</Badge>
<Badge variant="success">Ready</Badge>
<Badge variant="warning">Review</Badge>
<Badge variant="destructive">Blocked</Badge>
</>
);
}API
Badge
| Prop | 型 | 既定値 | 説明 |
|---|---|---|---|
children | ReactNode | — | Text shown inside the badge. |
variant | "secondary" | "success" | "warning" | "destructive" | — | Visual meaning written to data-variant; keep status understandable in text. |
size | "sm" | "md" | "lg" | — | Visual scale written to data-size; omitted when unset. |
as | ElementType | "span" | Native element or component used for the root. |
className | string | — | ルート要素に適用するクラス。 |
style | CSSProperties | — | Native root styles. |
ref | Ref<HTMLElement> | — | Ref forwarded to the rendered root element. |
render | ReactElement | ((props, state) => ReactElement) | — | 動作とアクセシビリティの接続を維持したまま、描画する要素を置き換えます。 |
キーボード
| キー | 操作 |
|---|
アクセシビリティ
Static text marker with no role or keyboard behavior. Keep its meaning in visible words and do not use it as a control.
スタイリングのフック
data-uiify-badgedata-variantdata-size