A date range picker for dashboards, with presets and typed start and end dates.
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { DateRangePicker, type DateRangeValue, type RangePresetGroup } from "@/components/ui/notchset/date-range-picker";
/** Presets from a day: calendar arithmetic (the date's own day field), so DST never shifts a day. */
function presetsFor(today: Date): RangePresetGroup[] {
const day = (n: number) => new Date(today.getFullYear(), today.getMonth(), today.getDate() + n);
return [
{
group: "RECENT",
items: [
{ label: "Last 7 days", from: day(-7), to: day(-1) },
{ label: "Last 30 days", from: day(-30), to: day(-1) },
],
},
];
}
// `today` comes from the request, so a long-running server never serves yesterday's presets.
export function ReportRange({ today }: { today: Date }) {
const presets = React.useMemo(() => presetsFor(today), [today]);
const recent = presets[0]!.items[0]!;
const [range, setRange] = React.useState<DateRangeValue>({ from: recent.from, to: recent.to });
return <DateRangePicker value={range} onValueChange={setRange} presets={presets} max={recent.to} />;
}value / onValueChange–
{ from: Date, to: Date }Changes only on APPLY or a preset.
presets–
{ group, items: { label, meta?, from, to }[] }[]The rail.
min / max–
DateThe pickable span.
customLabel–
stringThe rail's last row (clears and focuses FROM).
events–
Record<YYYY-MM-DD, string[]>Dots under days.
DateRangePickerdata-slot="date-range-picker-trigger"
The trigger.
—data-slot="date-range-picker-content"
The popup.
components/ui/notchset/date-range-picker.tsx
pnpm dlx shadcn@latest add https://notchset.dev/r/date-range-picker.jsonpnpm dlx shadcn@latest add https://notchset.dev/r/radix-nova/date-range-picker.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @notchset registry added, @notchset/<name> picks for you.
pnpm add @base-ui/react@^1The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)v1.0.0 · 2026-10-02
First release