@stratakit/bricks
Version:
Small, modular components for StrataKit
37 lines (36 loc) • 1.03 kB
JavaScript
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
})]
});
});
var Badge_default = Badge;
export {
Badge_default as default
};