Design System

Component usage guide template

Browse Components

rhf

RHF Date Range Picker

React Hook Form wrapper cho DateRangePicker với hỗ trợ validation và error handling tích hợp.

1. Import
Import the RHF Date Range Picker component from the design system.
import { RHFDateRangePicker } from "@/design-system/components/rhf";
2. Props
RHF Date Range Picker component props.
PropTypeDefault
controlControl<T>--
namePath<T>--
callback(value: { from?: Date; to?: Date } | undefined) => void--
labelstring | React.ReactNode--
requiredbooleanfalse
errorstring--
classNamestring--
3. Usages
Các pattern và cấu hình RHFDateRangePicker phổ biến.
import { RHFDateRangePicker } from "@/design-system/components/rhf";
import { useForm } from "react-hook-form";

function Example() {
  const { control } = useForm({
    defaultValues: {
      dateRange: undefined,
    },
  });

  return (
    <RHFDateRangePicker
      control={control}
      name="dateRange"
      label="Date Range"
      placeholder={{ from: 'From date', to: 'To date' }}
    />
  );
}