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
| Свойство | Тип | По умолчанию | Описание |
|---|---|---|---|
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