React Native / Inputs
DatePicker
Pick a day from a calendar. The field opens a bottom sheet with one month at a time; every day is a button named with its full date ("Tuesday, December 1, 2026"), and the month heading is announced when it changes. Choosing a day closes the sheet and puts screen reader focus back on the field.
import { DatePicker } from "@stylhero/native";
Example
import { useState } from "react";
import { DatePicker } from "@stylhero/native";
function DatePickerExample() {
const [date, setDate] = useState<Date | null>(null);
return (
<DatePicker
label="Remind me on"
value={date}
onChange={setDate}
min={new Date()}
hint="We'll check the price again that day."
/>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label required |
string |
- | Visible label, also read by screen readers. |
onChange required |
(date: Date) => void |
- | Called with the chosen day at local midnight. |
value required |
Date | null |
- | The chosen day, or null. Only the date part is used. |
bottomInset |
number |
- | Extra space under the calendar, e.g. the bottom safe-area inset. |
disabled |
boolean |
- | |
error |
string |
- | Error message. Turns the border red and is read with the field. |
formatDate |
(date: Date) => string |
- | Text for the chosen date in the field. Default: medium date in locale ("Dec 1, 2026"). |
hint |
string |
- | |
isDateDisabled |
(date: Date) => boolean |
- | Days that can't be chosen besides those outside min/max, e.g. weekends. |
locale |
string |
- | BCP 47 locale for month, weekday and date names. Default: the device's. |
max |
Date |
- | |
min |
Date |
- | Earliest and latest days that can be chosen. |
nextMonthLabel |
string |
"Next month" |
|
placeholder |
string |
"Choose a date" |
Shown while nothing is chosen. Default "Choose a date". |
previousMonthLabel |
string |
"Previous month" |
Spoken names of the month buttons. Default "Previous month" / "Next month". |
style |
StyleProp<ViewStyle> |
- | |
testID |
string |
- | |
weekStartsOn |
0 | 1 | 2 | 3 | 4 | 5 | 6 |
0 |
0 = Sunday (default), 1 = Monday, … |
Screen reader gestures
| Gesture (VoiceOver / TalkBack) | Does |
|---|---|
| Double-tap the field | Opens the calendar |
| Swipe right / left | Moves through the days, each read with its full date |
| Double-tap a day | Chooses it and closes the calendar |
Accessibility
- The field reads its label and the chosen date, or "Not chosen".
- Every day is named with its full date ("Wednesday, March 4, 2026"), today says "Today", and the month is announced when it changes.
- Day names and dates come from
Intl, so they followlocale.
Generated from src/components/DatePicker.tsx. Something wrong or missing? Open an issue.