Date Picker
Native system date-picker field backed by @react-native-community/datetimepicker.
Identity
Section titled “Identity”- Category: Forms & selection
- Status: stable public Registry/export-map component family
- Targets: iOS · Android · Web, subject to the compatibility contract
- Prerequisites:
@beemvp/beeui-uiinstalled (or this component’s source copied via the Registry CLI below) and, on Web, the BeeUI Tailwind/Uniwind theme CSS loaded — see Start for full platform setup. - Source:
packages/ui/src/components/date-picker.native.tsx
Import
Section titled “Import”import { DatePicker } from '@beemvp/beeui-ui';There is no documented deep/private source import. For source ownership from a BeeUI checkout:
pnpm beeui add date-pickerRegistry (used throughout this page) is BeeUI’s source-ownership manifest — registry/registry.json — that the pnpm beeui/@beemvp/beeui-cli CLI reads to copy a component’s real source into your app and rewrite its internal imports; it is not an npm package index. This component’s own Registry entry: registry/registry.json.
Composition and public API
Section titled “Composition and public API”- Primary export:
DatePicker- Also routed here, outside the Registry family:
date-picker
- Package export subpath:
@beemvp/beeui-ui/date-picker
- Also routed here, outside the Registry family:
Exported types: DatePickerAlign, DatePickerCollisionPadding, DatePickerDirection, DatePickerPlacement, DatePickerProps
The generated API inventory is mechanically joined to packages/ui/src/index.ts, Registry metadata, and the component reference contract. Each type’s field table below is parsed directly from that source, not a second hand-maintained copy; for the fuller behavior narrative see the canonical component behavior catalog.
State and behavior contract
Section titled “State and behavior contract”Controlled value/onValueChange (CalendarDate | null) field wrapping the native system date picker; disabled blocks opening the picker, and clearable opts in an explicit clear affordance rather than allowing an implicit empty selection. A wrapping Field’s required state no longer injects an English word into the trigger’s accessible name — pass the field’s own localized-required prop to append copy instead.
DatePickerProps
Section titled “DatePickerProps”| Prop | Type | Default | Description |
|---|---|---|---|
accessibilityLabel |
string |
— | Accessible name for the trigger. Falls back to the enclosing Field’s label. |
align |
DatePickerAlign |
'start' |
Web-only: Popover content alignment relative to the trigger. Ignored on native. |
className |
string |
— | Extra utility classes, merged after the component’s own via cn(...), so they win on conflict. An escape hatch for source-owned and application work, not a cross-engine portability guarantee. |
clearAccessibilityLabel |
string |
'Clear date' |
Accessible label for the clear button shown when clearable and a value is selected. Defaults to 'Clear date'. |
clearable |
boolean |
true |
Shows a clear affordance when a value is selected. Defaults to true. |
closeOnOutsidePress |
boolean |
true |
Web-only: dismiss the Popover on an outside press. Ignored on native. |
collisionPadding |
DatePickerCollisionPadding |
8 |
Web-only: Popover collision padding. Ignored on native. |
defaultOpen |
boolean |
— | Uncontrolled initial open state. Ignored once open is controlled. |
direction |
DatePickerDirection |
— | Web-only: logical direction for the Popover/Calendar content. Ignored on native. |
disabled |
boolean |
— | Disables the trigger, so it cannot open the picker. Combined with the enclosing Field’s own disabled. |
flip |
boolean |
true |
Web-only: flips Popover placement to stay in the viewport. Ignored on native. |
formatValue |
(date: CalendarDate, locale: string) => string |
— | Overrides the default Intl-based formatted display. |
invalid |
boolean |
— | Marks the trigger as invalid for styling and accessibility. Combined with the enclosing Field’s own invalid. |
isDateDisabled |
(date: CalendarDate) => boolean |
— | Marks individual dates as disabled in the Calendar grid, without disabling the trigger itself. |
locale |
string |
— | Explicit-only (ADR-008) — no ambient device/browser locale auto-detection. Defaults to 'en-US'. |
max |
CalendarDate |
— | Latest selectable date (inclusive), forwarded to the Calendar; later dates render disabled. |
min |
CalendarDate |
— | Earliest selectable date (inclusive), forwarded to the Calendar; earlier dates render disabled. |
nextMonthAccessibilityLabel |
string |
'Next month' |
Accessible label for the Calendar’s “next month” button. Defaults to 'Next month'. |
onOpenChange |
(open: boolean) => void |
— | Controlled/uncontrolled open state — BeeUI owns Web presentation (Popover). |
onValueChange |
(date: CalendarDate | null) => void |
— | null signals an explicit clear (see clearable). |
open |
boolean |
— | Controls whether the picker (Web Popover, native system picker) is open. Requires onOpenChange; otherwise falls back to internal open state with a dev-mode warning. |
placeholder |
string |
— | Text shown on the trigger when no date is selected. Defaults to 'Select a date'. |
placement |
DatePickerPlacement |
'bottom' |
Web-only: Popover placement relative to the trigger. Ignored on native. |
previousMonthAccessibilityLabel |
string |
'Previous month' |
Accessible label for the Calendar’s “previous month” button. Defaults to 'Previous month'. |
readOnly |
boolean |
false |
Keeps the trigger focusable/announced but blocks opening and clearing. |
shift |
boolean |
true |
Web-only: Popover collision-shift. Ignored on native. |
sideOffset |
number |
8 |
Web-only: Popover offset from the trigger. Ignored on native. |
style |
StyleProp<ViewStyle> |
— | Forwarded to the trigger’s root View. |
testID |
string |
— | Test identifier. Forwarded to the native testID and, on Web, emitted as data-testid. |
value (required) |
CalendarDate | null |
— | Controlled selected date (ADR-008) — single-date selection only for 1.0. |
weekStartsOn |
CalendarWeekStartsOn |
— | Which day starts each week row in the Calendar. Defaults to the convention for locale when omitted. |
Related exported types:
DatePickerAlign— alias ofAnchoredOverlayAlign.DatePickerCollisionPadding— alias ofAnchoredOverlayCollisionPadding.DatePickerDirection— alias ofAnchoredOverlayDirection.DatePickerPlacement— alias ofAnchoredOverlayPlacement.
The executable fixtures below are the source-grounded usage examples; consumers should not infer state ownership from DOM structure or another UI library.
Provider and dependencies
Section titled “Provider and dependencies”BeeUIProvideris required above this family because it participates in shared overlay/toast runtime infrastructure.- Peer/native dependencies visible to this Registry item:
@react-native-community/datetimepicker,react,react-native - Registry dependency closure:
button,calendar,core-overlay,dialog,field-context,icon-button,popover,text,theme - On Web this family renders from
date-picker.web.tsx, which does not import@react-native-community/datetimepicker: that peer serves the native implementation. - Safe-area ownership remains explicit: shell surfaces touching system edges opt into
SafeArea; components do not silently invent app-shell insets. - Web consumers load the BeeUI semantic theme CSS as documented in Web onboarding.
Platform behavior
Section titled “Platform behavior”This family is split by platform and renders from date-picker.native.tsx (iOS and Android), date-picker.web.tsx (Web). Where the two shapes differ, the difference is listed under the affected type above rather than summarised here.
This family has platform-split source files. The bundler selects the native/Web implementation; do not infer native runtime behavior from the Web preview.
Evidence classes are not equal and this page does not blur them: Web behavior is exercised in a real browser, while iOS and Android carry package/export and native-compile evidence, which is not device-runtime proof. The compatibility contract records which class each claim rests on.
Accessibility
Section titled “Accessibility”- Roles this family assigns:
button(iOS and Android) — set indate-picker.native.tsxby the components themselves, not by the caller. - Accessibility states and properties it sets:
accessibilityHint,accessibilityLabel,accessibilityLabelledBy,disabled,expanded(Web),hidden— read fromdate-picker.native.tsx,date-picker.web.tsx,date-picker-shared.tsx.
Keyboard/focus behavior, announcements, Dynamic Type/Web zoom, RTL and reduced-motion expectations are not derived here — see Accessibility overview, Keyboard & focus, RTL/localization and Large text & zoom. BeeUI does not claim universal accessibility certification from automated tests.
Styling and theming
Section titled “Styling and theming”- Style axes: not enumerated here:
align,collisionPadding,direction,placementare typed by an alias this page does not resolve to values. - Class-name surfaces:
className.
Colors, spacing and typography come from semantic tokens rather than from values written here — see Theming and Density. A className is an escape hatch for source-owned and application work, not a cross-engine portability guarantee.
Executable examples
Section titled “Executable examples”- Primary executable fixture:
apps/showcase/component-gallery/date-picker-showcase.tsx - Additional fixture:
apps/showcase/runtime-smoke/l10n-stress-acceptance.tsx
Addressable examples
Section titled “Addressable examples”Each link below opens the Showcase at that exact example, not at the top of the gallery:
basic— smallest meaningful complete usage
The Showcase links demonstrate Web behavior; use the native-preview guide for real simulator/emulator/device paths.
Live Web preview
Section titled “Live Web preview”This frame loads the real BeeUI Web Showcase on demand; it is not a second docs-only implementation. It proves browser behavior only. Use native preview for iOS/Android simulator, emulator or device paths.
Composition anatomy
Section titled “Composition anatomy”- Family root / primary export:
DatePicker- Exported type surface:
DatePickerAlignDatePickerCollisionPaddingDatePickerDirectionDatePickerPlacementDatePickerProps
- Exported type surface:
The tree above is ordinary document structure so it remains readable with keyboard and assistive technology; it is derived from the real public export family rather than a canvas-only diagram.
Verified example source
Section titled “Verified example source”The following is the exact typechecked runtime Showcase fixture selected for this live preview: apps/showcase/component-gallery/date-picker-showcase.tsx. Runtime gallery/pattern sources are preferred over test harnesses, and the displayed source and executable source are the same file; there is no separately maintained demo snippet.
import { Card, DatePicker, Field, Section, Text, VStack, type CalendarDate } from '@beemvp/beeui-ui';import * as React from 'react';
// BeeUI issue #173 (R4F.3, ADR-008 "DatePicker" contract). A minimal, representative// gallery fixture for Playwright browser-interaction evidence: keyboard grid// navigation inside the Popover-hosted Calendar, Escape dismissal, focus restoration,// clearing, and Field validation. Deterministic behavior (selection, clearing,// bounds/disabled dates, Field error semantics, controlled-state edge cases) already// has Jest coverage in `apps/showcase/__tests__/issue-173-date-picker-web.test.tsx`;// this fixture exists for what only a real browser can prove.
const MIN_DATE: CalendarDate = { day: 5, month: 1, year: 2026 };const MAX_DATE: CalendarDate = { day: 25, month: 1, year: 2026 };
function isWeekend(date: CalendarDate): boolean { const dayOfWeek = new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay(); return dayOfWeek === 0 || dayOfWeek === 6;}
export function DatePickerShowcase() { const [controlledValue, setControlledValue] = React.useState<CalendarDate | null>({ day: 15, month: 1, year: 2026, }); // Seeded to a January 2026 weekday (not `null`) so the Calendar's initial visible // month is deterministic — an unset `value` would fall back to the current system // month, which would not reliably overlap this fixture's `min`/`max` window. const [boundedValue, setBoundedValue] = React.useState<CalendarDate | null>({ day: 15, month: 1, year: 2026, }); const [fieldValue, setFieldValue] = React.useState<CalendarDate | null>(null);
return ( <VStack gap="lg"> <Card className="gap-5" variant="raised"> <Section description="Controlled selected value, formatted display, and an explicit clear affordance." title="Controlled DatePicker" > <VStack gap="xs"> <DatePicker onValueChange={setControlledValue} testID="date-picker-showcase-controlled" value={controlledValue} /> <Text testID="date-picker-showcase-controlled-state" tone="muted" variant="caption"> {`value: ${controlledValue ? `${controlledValue.year}-${controlledValue.month}-${controlledValue.day}` : 'null'}`} </Text> </VStack> </Section> </Card>
<Card className="gap-5"> <Section description="min/max bounds and a weekend isDateDisabled predicate block selection in the Calendar grid." title="Bounded / disabled dates" > <DatePicker isDateDisabled={isWeekend} max={MAX_DATE} min={MIN_DATE} onValueChange={setBoundedValue} testID="date-picker-showcase-bounded" value={boundedValue} /> </Section> </Card>
<Card className="gap-5"> <Section description="Field-integrated trigger derives label/required/error." title="Field validation"> <Field error={fieldValue ? undefined : 'Date of birth is required'} invalid={!fieldValue} label="Date of birth" required > <DatePicker onValueChange={setFieldValue} testID="date-picker-showcase-field" value={fieldValue} /> </Field> </Section> </Card> </VStack> );}Use the code block’s copy affordance to copy the exact fixture. For a smaller app-specific example, start from the public imports shown above and keep only the state your screen owns.
Limitations
Section titled “Limitations”locale affects Calendar’s own weekday/month grid, Intl-based date formatting, and — when the caller omits placeholder — the trigger’s own default placeholder text, drawn from a small built-in dictionary (en-US/vi-VN today) that falls back to the English copy for any other locale. It does not translate the month-navigation accessible labels, which stay separate string props with hardcoded English defaults. A localized app must pass previousMonthAccessibilityLabel and nextMonthAccessibilityLabel explicitly alongside locale.
- Passing
openwithoutonOpenChangeleaves the value read-only: the component renders what you passed and can never change it. It warns in development builds rather than failing silently in production. - Requires
@react-native-community/datetimepickerto be installed by the consuming app. It is an optional peer of@beemvp/beeui-ui, so nothing installs it for you, and a target that never renders this family does not need it.
Implementation note: Platform-split: resolves date-picker.native.tsx / date-picker.web.tsx at build time.