SwipeUI

Date picker

Shared date API for the OS native picker or a token-aware calendar sheet.

npx @swipeui/cli add date-picker
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Date fields in forms, such as birthday, start date or due date.
  • Using the system date picker people already know.
  • A custom calendar sheet that matches your theme, with Cancel and Apply.
  • Fields that need min and max dates or blocked days.

When not to use it

  • Picking a range. Use Date range picker.
  • Time only. Use Time picker.
  • A calendar that's always visible on screen. Use Calendar.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add date-picker
  • Adds components/swipeui/ui/use-date-picker.ts, components/swipeui/ui/picker-support.ts, components/swipeui/ui/use-picker-warning.ts, components/swipeui/ui/date-picker.tsx and 19 shared helpers.
  • Installs react-native-svg, @expo/ui, uniwind, clsx, tailwind-merge, react-native-reanimated, react-native-worklets, class-variance-authority, expo-haptics, react-native-gesture-handler, react-native-safe-area-context, @gorhom/bottom-sheet, expo-blur. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/booking.tsx
import { DatePicker } from '@/components/swipeui/ui/date-picker';

<DatePicker label="Appointment" />;

Examples

Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.

API reference

DatePickerProps

PropTypeDefaultDescription
minDate?Date—

The earliest day that can be chosen.

maxDate?Date—

The latest day that can be chosen.

isDateDisabled?((date: Date) => boolean)—

Your own rule for days that can't be chosen.

weekStartsOn?"locale" | WeekStart1

First day of the week, Sunday = 0, or locale to follow the locale's week where the engine reports it (browsers do; Hermes doesn't, so it falls back to Monday). Monday by default, so the app and the web match.

firstDayOfWeek?WeekStart—

1.x name for weekStartsOn.

locale?stringthe device's

Locale for month and weekday names.

success?string—

Confirmation, such as "Username available". Replaces the helper; an error replaces it.

status?FieldStatus'idle'

Validation state the control shows: a spinner while validating, a check when valid. An error implies invalid.

required?booleanfalse

Whether a value is required.

disabledStyle?FieldDisabledStyle'muted'

muted lightens the field without opacity; dim lowers the whole field to 50%.

appearance?FieldAppearancethe control's own default ('filled')

Surface look passed to the control.

size?FieldSizethe control's own default ('md')

Control size passed to the control.

shape?FieldShapethe control's own default ('preset')

Control shape passed to the control.

labelPlacement?FieldLabelPlacement'above'

Where the label sits. inset and floating are drawn inside the control by Text field and Field trigger.

focusRing?FieldFocusRingthe control's own default ('halo')

Focus indicator passed to the control.

labelstring—

Visible and spoken field label.

value?Date | null—

Controlled local day.

defaultValue?Date | nullnull

Initial day.

onValueChange?((value: Date | null) => void)—

Reports an accepted local day after confirmation.

engine?"custom" | "native"'native'

Native OS picker or token-aware calendar.

open?boolean—

Controlled presentation.

defaultOpen?booleanfalse

Initial presentation.

onOpenChange?((open: boolean) => void)—

Reports opening, confirmation or dismissal.

placeholder?string'Choose a date'

Empty trigger text.

helper?string—

Supporting instructions.

error?string—

Validation message.

disabled?booleanfalse

Prevent opening and selection.

motion?MotionOverride—

Custom engine motion; native owns its motion.

haptics?booleantrue

Trigger feedback.

presentation?"auto" | "native" | "popover" | "sheet"—

Auto uses a sheet on phones and an anchored popover on wider screens.

closeOnSelect?booleantrue

Close shortly after selecting a date.

closeDelay?number250

Content delay before closing in milliseconds.

shortcuts?unionfalse

Enable default shortcuts or supply named local dates.

format?Intl.DateTimeFormatOptions | ((date: Date) => string)—

Intl options or your own formatter.

clearable?booleanfalse

Show an external clear action.

messages?object—

Shortcut and clear labels.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Native layout escape hatch.

testID?string—

Trigger ID.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Date picker settings

PropDoesDefault
hapticsEnables selection or press feedbacktrue
motionOverrides the app's motion feelApp feel

| presentation | auto, popover, sheet or native | auto | | clearable | Clear the date | false | | closeOnSelect | Close after picking | true | | closeDelay | Content delay before closing | 250ms | | shortcuts | Today, Tomorrow, Next week or custom dates | false | | format | Intl options or a formatting callback | Medium date | | weekStartsOn | Calendar week start | Monday |

engine="custom" without presentation keeps the 1.x Apply/Cancel draft. New presentations pick directly. The embedded Calendar uses surface="plain" caption={false}. Native runtime remains pending.

Composition and behavior

  • A labelled field that opens the OS picker or a Calendar sheet with Cancel and Apply.
  • engine chooses native or custom; open and onOpenChange control it.
  • value and onValueChange hold the confirmed day.

Engine support

CapabilityNative iOSNative AndroidCustom iOS/Android
Requested localeYesOS-owned / unsupportedYes
Shared custom motionOS-owned / unsupportedOS-owned / unsupportedYes
Preset colours and shapesOS-owned / unsupportedOS-owned / unsupportedYes
Disabled-date predicateOS-owned / unsupportedOS-owned / unsupportedYes
Requested 12/24-hour displayOS-owned / unsupportedYesYes
Minute intervalsOS-owned / unsupportedOS-owned / unsupportedYes

Native iOS is inline inside the sheet; Android uses an OS dialog. Native iOS follows locale/system hour settings. Custom minute intervals must divide 60. Acceptance always checks date constraints, but the native engine cannot visually disable arbitrary dates. Static adapter support does not establish native runtime compatibility.

Behavior and gestures

  • Tap the field to open the native picker (the default) or a calendar sheet (custom engine).
  • In the custom sheet, pick a day, then Apply to confirm or Cancel to discard your change.
  • The field only updates after you confirm.
  • Unsupported options for the native engine are reported in development, never silently ignored.

Accessibility

  • The field reads its label and current value, such as "Start date: 3 Nov 2026", and reports expanded state.
  • Apply is labelled with the field name, such as "Apply Start date".
  • The native engine brings the platform's own accessibility.
  • Helper and error text are read as the field's hint.

Motion

  • Uses the overlay, layout and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • The custom sheet uses the overlay role; the native picker uses system motion.
  • Reduce Motion fades the sheet.

Performance

  • The native engine costs nothing until opened; the custom one mounts its calendar on open.

Notes for AI

  • Use engine="custom" when you need isDateDisabled; see the engine support table.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items