Skip to content
العربية
Saudi forms and dates

DateRangePicker

A date range for list filters, with the presets today, yesterday, this week, this month and last month. A preset applies at once; a range open at one end is valid (“From 12/09/2026”). The range reads left to right in both languages. In a toolbar, size="sm" gives it the height of the buttons next to it. defaultCalendar sets the calendar shown first.

import { DateRangePicker, rangePreset, type DateRange, type DateRangePresetId } from "@percentsa/ui";

Examples

Code
export function DateRangePickerExample() {
  const t = useT();
  const [range, setRange] = useState<DateRange>({ from: null, to: null });
  return (
    <Field label={t("Order date", "تاريخ الطلب")} className="w-full max-w-xs">
      <DateRangePicker value={range} onValueChange={setRange} />
    </Field>
  );
}