UNPKG

@stratakit/bricks

Version:

Small, modular components for StrataKit

31 lines (30 loc) 1.06 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { Role } from "@ariakit/react/role"; import { Text } from "@stratakit/bricks"; import { Icon } from "@stratakit/foundations"; import { forwardRef } from "@stratakit/foundations/secret-internals"; import cx from "classnames"; import { useInit } from "./~utils.useInit.js"; const Badge = forwardRef((props, forwardedRef) => { useInit(); const { tone = "neutral", variant = "solid", label, icon, ...rest } = props; return /* @__PURE__ */ jsxs( Role.span, { ...rest, "data-_sk-tone": tone, "data-_sk-variant": variant, className: cx("\u{1F95D}Badge", props.className), ref: forwardedRef, children: [ typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon, /* @__PURE__ */ jsx(Text, { variant: "body-sm", className: "\u{1F95D}BadgeLabel", render: /* @__PURE__ */ jsx("span", {}), children: label }) ] } ); }); DEV: Badge.displayName = "Badge"; var Badge_default = Badge; export { Badge_default as default };