CalendarNew
A dependency-free date picker — single, multiple, or range selection with sliding month transitions, a month/year quick-jump, event markers, and preset shortcuts.
Preview & playground
Edit the code — the preview updates live. Try changing props, text, or classes.
function Demo() { const [date, setDate] = useState(new Date()) const marks = { 12: "accent", 18: "accent-2", 24: "accent-3" } return ( <div className="flex flex-col items-center gap-3"> <Calendar mode="single" selected={date} onSelect={setDate} showToday markers={(d) => marks[d.getDate()]} /> <p className="text-sm text-muted"> {date ? date.toLocaleDateString(undefined, { dateStyle: "full" }) : "Pick a day"} </p> </div> ) } render(<Demo />)
Examples
Common variations — edit any of them live.
Range across two months
Drag from one day to another — hover previews the span before you commit.
function Demo() { const [range, setRange] = useState({ from: undefined, to: undefined }) return ( <Calendar mode="range" numberOfMonths={2} selected={range} onSelect={setRange} /> ) } render(<Demo />)
Multiple days
Toggle any number of individual days on and off.
function Demo() { const [days, setDays] = useState([]) return ( <div className="flex flex-col items-center gap-3"> <Calendar mode="multiple" selected={days} onSelect={setDays} /> <p className="text-sm text-muted">{days.length} day(s) selected</p> </div> ) } render(<Demo />)
Week numbers & Monday start
ISO week column, weeks starting on Monday, no outside days.
render( <Calendar weekStartsOn={1} showWeekNumbers showOutsideDays={false} /> )
Bounded & disabled days
Limit the window with fromDate/toDate and grey out weekends via disabled.
function Demo() { const today = new Date() const in30 = new Date() in30.setDate(today.getDate() + 30) return ( <Calendar mode="single" fromDate={today} toDate={in30} disabled={(d) => d.getDay() === 0 || d.getDay() === 6} /> ) } render(<Demo />)
Range with quick-pick presets
A side rail of one-click shortcuts — the range picker analytics dashboards ship.
function Demo() { const [range, setRange] = useState({ from: undefined, to: undefined }) const days = (n) => { const to = new Date() const from = new Date() from.setDate(to.getDate() - (n - 1)) return { from, to } } const monthToDate = () => { const to = new Date() return { from: new Date(to.getFullYear(), to.getMonth(), 1), to } } return ( <Calendar mode="range" numberOfMonths={2} selected={range} onSelect={setRange} showToday presets={[ { label: "Today", value: () => ({ from: new Date(), to: new Date() }) }, { label: "Last 7 days", value: () => days(7) }, { label: "Last 30 days", value: () => days(30) }, { label: "Month to date", value: monthToDate }, ]} /> ) } render(<Demo />)
Event markers
Drop up to three coloured dots on any day — meetings, deadlines, availability.
function Demo() { const events = { 9: ["accent"], 14: ["accent", "accent-2"], 18: ["destructive"], 23: ["accent-3", "accent", "accent-2"], } return ( <Calendar mode="single" defaultSelected={new Date()} markers={(d) => events[d.getDate()]} /> ) } render(<Demo />)
Installation
Copy the source into your project with the registry CLI:
$pnpm dlx shadcn@latest add @stacklyui/calendarOr install the package and import it:
$pnpm add @stacklyui/ui motionUsage
No react-day-picker, no date-fns — just native Date + Intl. Set mode to single, multiple, or range. Click the month or year in the header to zoom out and jump across years. Use markers to drop coloured event dots on any day, presets for one-click ranges, and showToday for a Today/Clear footer. Arrow keys move day-by-day, Home/End jump to week edges, PageUp/PageDown change months (hold Shift for years).