Date range picker
A period: quick picks, then a month where the first click sets the start and the second the end.
import { DateRangePicker, type DateRange } from "@forgeron/ui";import { DateRangePicker, type DateRange } from "@forgeron/ui";
import { useState } from "react";
export default function Period() {
const [range, setRange] = useState<DateRange>({ from: "2026-11-03", to: "2026-11-18" });
return <DateRangePicker label="Period" today="2026-11-19" value={range} onChange={setRange} />;
}import { DateRangePicker } from "@forgeron/ui";
export default function Chip() {
return (
<DateRangePicker
label="Sprint"
variant="chip"
today="2026-11-19"
placeholder="Set sprint"
presets={[]}
/>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | e.g. Period. |
value / defaultValue | { from, to } | — | Controlled or not. Each YYYY-MM-DD or null. |
onChange | (range: DateRange) => void | — | Complete ranges only. |
presets | { label, from, to }[] | rangePresets(today) | Today, last 7 and 30 days, this and last month; [] for none. |
min / max | string | — | Days outside cannot be chosen. |
today | string | the device's date | Outlined. |
clearable | boolean | true | Offers to remove the range. |
variant | "field" | "chip" | "field" | A form control, or a record's property. |
disabled | boolean | — | Not editable. |
className | string | — | Extra classes. |