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>);End Icons
Section titled “End Icons”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>);Sizing
Section titled “Sizing”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>);API Reference
Section titled “API Reference”Inherits properties from HTMLElement.