19 lines
513 B
TypeScript
19 lines
513 B
TypeScript
import { Label } from "@repo/shadcn-ui/components/label";
|
|
import { Switch } from "@repo/shadcn-ui/components/switch";
|
|
import type { ComponentProps, ReactNode } from "react";
|
|
|
|
type SwitchFieldProps = Readonly<
|
|
ComponentProps<typeof Switch> & {
|
|
label: ReactNode;
|
|
}
|
|
>;
|
|
|
|
export function SwitchField({ id, label, ...switchProps }: SwitchFieldProps) {
|
|
return (
|
|
<div className="flex items-center gap-2">
|
|
<Switch id={id} {...switchProps} />
|
|
<Label htmlFor={id}>{label}</Label>
|
|
</div>
|
|
);
|
|
}
|