import * as React from "react" import { Switch as SwitchPrimitive } from "@base-ui/react/switch" import { cn } from "../core/cn" interface SwitchToggleProps extends SwitchPrimitive.Root.Props { label?: string labelPosition?: "left" | "right" className?: string } function SwitchToggle({ className, label, labelPosition = "right", id, ...props }: SwitchToggleProps) { const internalId = React.useId() const switchId = id ?? internalId const switchEl = ( ) if (!label) return switchEl return (
{labelPosition === "left" && ( )} {switchEl} {labelPosition === "right" && ( )}
) } export { SwitchToggle } export type { SwitchToggleProps }