Forms Core Stable

DatePicker

A field that opens a floating month grid, with full keyboard navigation (arrow keys across days, Page Up/Down across months, Shift for years), min/max and per-day disabling, and a fully localized accessible name on every day cell.

Preview

Installation

pnpm add fancy-ui-svelte
import { DatePicker } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { DatePicker } from 'fancy-ui-svelte';
</script>

<DatePicker />

Examples

Basic Usage

With Bounds

Restricted to a 30-day window starting today.

Disabled Dates

Weekends rejected via isDateDisabled.

With FormField

Wrapped in FormField — required and the error message driven by context.

Props

PropTypeDefaultDescription
value Date | nullnullThe selected date; bindable. Always a local-midnight Date — see the README's time-zone note.
onValueChange (value: Date | null) => void-Called with the new value whenever a day is picked.
min Date-Earliest selectable day (inclusive), compared at day granularity.
max Date-Latest selectable day (inclusive), compared at day granularity.
weekStartsOn 0 | 110 for Sunday, 1 for Monday.
disabled booleanfalseBlocks opening the panel; excludes the control from form submission.
required booleanfalseMarks the field required for the surrounding form.
invalid booleanfalseDrives the error border and aria-invalid.
id string-Element id.
name string-Native name. When set, a hidden input carries the value as YYYY-MM-DD.
label string-Accessible name — for a control with no visible Label next to it.
placeholder string"Pick a date"Shown in the trigger while no day is selected.
locale string-BCP 47 locale for month, weekday, day and trigger-label formatting.
isDateDisabled (date: Date) => boolean-Rejects individual days beyond min/max — e.g. weekends, holidays.
class string-Additional CSS classes, merged onto the trigger button.
ref HTMLButtonElement | nullnullBindable reference to the trigger button.