Design System

Component usage guide template

Browse Components

rhf

RHF Switch

A React Hook Form switch component with built-in error handling and validation support.

1. Import
Import the RHF Switch component from the design system.
import { RHFSwitch } from "@/design-system/components/rhf";
2. Props
RHF Switch component props.
PropTypeDefault
controlControl<T>--
namePath<T>--
labelstring--
descriptionstring--
requiredbooleanfalse
callback(newValue: boolean) => void--
onBeforeChangeRHFBeforeChange<T>--
wrapperClassNamestring--
labelClassNamestring--
descriptionClassNamestring--
errorClassNamestring--
3. Usages
Common RHF Switch patterns and configurations.
import { RHFSwitch } from "@/design-system/components/rhf";
import { useForm } from "react-hook-form";

function Example() {
  const { control } = useForm({
    defaultValues: {
      notifications: false,
    },
  });

  return (
    <RHFSwitch
      control={control}
      name="notifications"
    />
  );
}