Skip to content

Badge

A small, enclosed text element used to represent status.

To display a badge, wrap text in a <Badge>.

New
import { Badge } from "stylus-ui/Badge";
export default () => <Badge>New</Badge>;

Different colors of badges can be displayed by setting the variant.

Default
Success
Warning
Error
Brand
import { Badge } from "stylus-ui/Badge";
export default () => (
<div className="flex gap-2">
<Badge>Default</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">Warning</Badge>
<Badge variant="error">Error</Badge>
<Badge variant="brand">Brand</Badge>
</div>
);

Icons can be displayed within a badge by importing and passing a Font Awesome icon.

Verified
import { Badge } from "stylus-ui/Badge";
import { faCheck } from "@fortawesome/pro-regular-svg-icons";
export default () => (
<Badge variant="success" icon={faCheck}>
Verified
</Badge>
);
Translated by AI
import { Badge } from "stylus-ui/Badge";
import { faSparkle } from "@fortawesome/pro-regular-svg-icons";
export default () => (
<Badge variant="brand" iconEnd={faSparkle} size="lg">
Translated by AI
</Badge>
);

Badges can be either small (default), or large.

Small
Large
import { Badge } from "stylus-ui/Badge";
import { faCheck } from "@fortawesome/pro-regular-svg-icons";
export default () => (
<div className="flex items-center gap-2">
<Badge icon={faCheck}>Small</Badge>
<Badge icon={faCheck} size="lg">
Large
</Badge>
</div>
);

A small, enclosed text element used to represent status.

icon

IconDefinition

Icon shown before the label.


iconClassName

string

Classes applied to the start icon.


iconEnd

IconDefinition

Icon shown after the label.


iconEndClassName

string

Classes applied to the end icon.


size

"sm" | "lg" = "sm"

Height and padding: sm (compact) or lg.


theme

"light" | "dark"

Theme for contrast; affects icon color when set.


variant

"default" | "success" | "warning" | "error" | "brand" = "default"

Background and text color: default (gray), success, warning, error, or brand.