@stratakit/bricks
Version:
Small, modular components for StrataKit
24 lines (23 loc) • 682 B
JavaScript
import { jsx } from "react/jsx-runtime";
import { Checkbox as AkCheckbox } from "@ariakit/react/checkbox";
import { forwardRef } from "@stratakit/foundations/secret-internals";
import cx from "classnames";
import { useFieldControlType } from "./Field.internal.js";
const Switch = forwardRef((props, forwardedRef) => {
useFieldControlType("checkable");
return /* @__PURE__ */ jsx(
AkCheckbox,
{
accessibleWhenDisabled: true,
...props,
className: cx("\u{1F95D}-switch", props.className),
role: "switch",
ref: forwardedRef
}
);
});
DEV: Switch.displayName = "Switch";
var Switch_default = Switch;
export {
Switch_default as default
};