Components · Form Controls
Time Slot Picker
AlphaAdded v10.8.0
Pick one time from a list of slots, for booking flows.
import { TimeSlotPicker } from '@nexub/react';Playground
Props
size
columns
groupBy
Selected: 09:30
<TimeSlotPicker aria-label="Start time" slots={slots} value={time} onValueChange={setTime} />Examples
Default
Grouped by time of day
States
Selected: 09:30
defaultSelected: 09:30
disabledSelected: 09:30
invalidSelected: 09:30
readOnlySelected: 09:30
size="sm"Selected: 09:30
size="md"Selected: 09:30
size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| slotsrequired | TimeSlot[] | — | The times. value is HH:mm or an ISO date-time; the label defaults to the time in the provider locale. |
| value / defaultValue / onValueChange | string | — | The selected slot value. |
| groupBy | 'none' | 'period' | 'none' | period adds Morning, Afternoon and Evening headings. |
| columns | 'auto' | 2 | 3 | 4 | 'auto' | Slots per row. auto fits as many as the width allows; 3 and 4 drop to fewer where the picker is narrow. |
| size | 'sm' | 'md' | 'lg' | 'md' | Slot height. md and lg are at least 44px tall. |
| invalid / disabled / readOnly / required | boolean | — | Group states. Inside FormField.Control they come from the field. |
| name | string | — | Submits the selected value with a form. |
| emptyState | React.ReactNode | — | Shown when slots is empty. |
| invalid | boolean | — | |
| readOnly | boolean | — | Focusable but cannot change. |
Accessibility
Keyboard
- Tab
Moves into the group, to the selected slot.
- Arrow keys
Move to and select the next available slot.
Notes
A radio group: give it an `aria-label` or `aria-labelledby` (it defaults to "Choose a time").
Unavailable slots are struck through and read as "9:30 AM, unavailable".
A slot is named by its time; `hint` is its description.
On iOS & Android
Web only
Time Slot Picker has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.