Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Inputs

Calendar

Month grid (MUI X's DateCalendar). Arrows move by day/week, PageUp/PageDown by month, Enter picks.

import { Calendar } from "@stylhero/ui";

Example

Code
import { useState } from "react";
import { Calendar } from "@stylhero/ui";

function CalendarExample() {
  const [day, setDay] = useState<Date | null>(new Date());
  return <Calendar value={day} onValueChange={setDay} isDateDisabled={(d) => d.getDay() === 0} />;
}

Props

PropTypeDefaultDescription
autoFocus boolean - Focus the selected (or today's) day on mount, e.g. inside a popover.
className string -
isDateDisabled (d: Date) => boolean - Return true to block a day (e.g. closed on Sundays).
locale string - BCP 47 locale for month and weekday names, e.g. "es-MX". Defaults to the browser's.
max Date -
min Date -
mode "single" | "range" -
onValueChange ((d: Date) => void) | ((r: DateRange) => void) -
value Date | null | DateRange -
weekStartsOn 0 | 1 0 0 = Sunday, 1 = Monday.

Types

type DateRange = [Date | null, Date | null];

Keyboard

KeyDoes
Arrow keysMove one day (left/right) or one week (up/down). Disabled days are skipped
Home / EndFirst / last day of the week
PageUp / PageDownPrevious / next month; with Shift, previous / next year
Enter / SpacePicks the focused day

Accessibility

  • A role="grid" of days with the month as its label. Only one day is in the Tab order; today has aria-current="date".

Generated from src/components/DatePicker.tsx. Something wrong or missing? Open an issue.