Tag
Display a small inline label for statuses, categories or counts.
Tag renders a Text as a div styled as a compact, fit-content flex row. Use it for statuses, categories or version labels. It is not marked "use client" and has no dependencies beyond Text.
Import#
import { Tag } from "@reactberry/system/blocks";
Usage#
import { Icon, Tag } from "@reactberry/system/blocks";
import { Box } from "@reactberry/system/elements";
export default function ReleaseTags() {
return (
<Box display="flex" gap="xxsmall">
<Tag skin="surface">v2.1.0</Tag>
<Tag skin="success">
<Icon icon="IconCCheck" size="0.875rem" />
Stable
</Tag>
</Box>
);
}
Examples#
With an icon#
Children are laid out in a flex row with gap="xxsmall", so an Icon sits next to the label.
As a link#
Pass as="a" and href to render the tag as a link; shape="pill" rounds it fully.
API#
Tag#
Tag declares no props of its own (its props are typed as an open record). children is rendered inside; every other prop is spread onto the Text after these defaults:
| Prop | Type | Default | Description |
|---|---|---|---|
as | string | ComponentType | "div" | Element or component to render. |
display | string | "flex" | CSS |
alignItems | string | "center" | CSS |
gap | string | "xxsmall" | Space between children. |
p | string | "xs" | Padding. |
py | string | "xxxs" | Vertical padding. |
color | string | "secondary" | Text colour. |
fontSize | string | "small" | Font size. |
fontWeight | string | "600" | Font weight. |
shape | string | "rounded" | Border radius shape. |
width | string | "fit-content" | Width. |
flex | string | "none" | CSS |
Accessibility#
Tagrenders a plaindivwith no role. Useas="a"withhreffor tags that navigate.
Notes#
Tagis a named export (export const Tag), unlike most blocks, which are default exports re-exported by name.- No background is set by default; use
skinorbgto give the tag a fill. - Props are untyped, so there is no compile-time checking of what you pass.