Skip to content

DatePicker

Calendar-driven date picker with single or range mode, day / month / year views, optional time picker with configurable defaults, min/max constraints, and Turkish or English locales.

Forms & Inputs·Available inReactVueAngular·View as Markdown

Preview

tsx
Loading preview…

Switch the framework picker (top-right of the panel) to render the same demo live in React, Vue, or Angular — same class names, ARIA, and visual output across all three.

Installation

Sisyphos UI ships unified packages for React, Vue, and Angular. Pick the one that matches your stack — every framework exports the same component classes, ARIA semantics, and CSS tokens.

$ pnpm add @sisyphos-ui/react

Then import the bundled stylesheet once at app entry: import "@sisyphos-ui/react/styles.css";

Usage

Idiomatic usage in each supported framework
import { useState } from "react";
import { DatePicker } from "@sisyphos-ui/react";

export const Birthday = () => {
  const [date, setDate] = useState<Date | null>(null);
  return <DatePicker label="Birthday" value={date} onChange={setDate} />;
};

Range mode

Add `isRange` and a `[Date | null, Date | null]` value.

tsx
Loading preview…

Min/max bounds

Restrict selectable dates with `minDate` / `maxDate`.

tsx
Loading preview…

Only dates in the next 3 months are selectable.

Custom format & locale

`format` controls the display string; `locale` drives weekday and month names.

tsx
Loading preview…

With time picker

`showTime` adds hour/minute selectors with configurable `minuteStep`.

tsx
Loading preview…

API

PropTypeDefaultDescription
valueDate | null | [Date | null, Date | null]Selected date, or `[start, end]` when `isRange` is true.
onChange(value) => voidCalled with the next value.
isRangebooleanfalseSwitches between single-date and range modes.
labelstringField label rendered above the trigger.
placeholderstringTrigger placeholder. Localized default.
variant"standard" | "outlined""outlined"Visual treatment.
size"sm" | "md" | "lg""md"Field height + typography scale.
minDateDateEarliest selectable date.
maxDateDateLatest selectable date.
formatstringTrigger format. Supports `yyyy/MM/dd/HH/mm`. Defaults to `dd.MM.yyyy` (or with time).
locale"tr" | "en""tr"Locale for weekday and month names.
showTimebooleanfalseAdds an hour/minute picker below the calendar.
minuteStepnumber15Minute increments inside the time picker.
defaultHournumber0Hour applied on the first date pick when no time is set yet.
defaultMinutenumber0Minute applied alongside `defaultHour`.
defaultStartHournumberRange mode: default hour for the start date. Falls back to `defaultHour`.
defaultStartMinutenumberRange mode: default minute for the start date. Falls back to `defaultMinute`.
defaultEndHournumberRange mode: default hour for the end date. Falls back to `defaultHour`.
defaultEndMinutenumberRange mode: default minute for the end date. Falls back to `defaultMinute`.
allowClearbooleanfalseShow a clear button on the trigger when a value is present.
fullWidthbooleanfalseStretch the trigger to its container.
calendarIconReactNodeOverride the default calendar icon.
placementPlacement"bottom-start"Initial popover placement (auto-flips when needed).
errorbooleanfalseMarks the field as invalid for styling and ARIA.
errorMessagestringMessage shown below the field when `error` is true.

The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README on npm.

Accessibility

  • Trigger input wires aria-haspopup="dialog", aria-expanded, and a unique id/aria-controls link to the popover.
  • The popover uses role="dialog" and is portal-mounted with auto-flip placement.
  • aria-invalid mirrors error; the error message uses role="alert".
  • Calendar navigation buttons carry descriptive aria-labels.

Keyboard interactions

KeyAction
TabMoves focus through the trigger and the in-popover controls.
ArrowUpthenArrowDownSteps through months in the months view, decades in the years view.
EscCloses the popover.
Need more?View on npm →
Was this page helpful?