Date Picker
DatePicker is a text field with a calendar. The header of the calendar switches between day,
month and year views.
import { DatePicker, parseDate } from '@beyul/sulmu-ui'Examples
Section titled “Examples”value and defaultValue are arrays of dates (one entry for a single date). Create dates with
parseDate('2025-09-30'), which the library re-exports from Ark UI.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
31 | 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 1 | 2 | 3 | 4 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
import { DatePicker, parseDate } from '@beyul/sulmu-ui'
export default function Example() { return ( <div style={{ maxWidth: 320 }}> <DatePicker aria-label="Closing date" defaultValue={[parseDate('2025-09-30')]} /> </div> )}Inside a Field
Section titled “Inside a Field”Inside a Field the label names the input, and an errorText marks
the input invalid.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
import { DatePicker, Field, Stack } from '@beyul/sulmu-ui'
export default function Example() { return ( <Stack style={{ maxWidth: 320 }}> <Field label="Closing date" required> <DatePicker /> </Field> <Field label="Start date" errorText="Choose a date"> <DatePicker size="lg" /> </Field> </Stack> )}| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | string | MM/DD/YYYY | Shown in the empty field. Default: "MM/DD/YYYY". |
size | "sm" | "md" | "lg" | md | sm 34px, md 40px, lg 44px. Default: md. |
invalid | boolean | - | Marks the value as wrong. Inside a Field this is set for you. |
aria-label | string | - | Defines a string value that labels the current element. |
defaultValue | DateValue[] | - | The initial selected date(s) when rendered. Use when you don't need to control the selected date(s) of the date picker. |
value | DateValue[] | - | The controlled selected date(s). |
name | string | - | The name attribute of the input element. |
max | DateValue | - | The maximum date that can be selected. |
disabled | boolean | - | Whether the calendar is disabled. |
onValueChange | ((details: ValueChangeDetails) => void) | - | Function called when the value changes. |
min | DateValue | - | The minimum date that can be selected. |
The remaining props of Ark UI’s DatePicker.Root are accepted too.
Accessibility and usage
Section titled “Accessibility and usage”- The date can be typed as well as picked, so the field works without the popup.
- The calendar button is labelled “Open calendar”; the header buttons are “Previous” and “Next”.
- Use
minandmax(dates fromparseDate) to limit the range. - Give it an
aria-labelwhen it is not inside a Field.