Components
MultiDatePicker
MultiDatePicker adapts SwiftUI's multi-date selection model to the web by combining a native date input with an ordered list of selected dates.
Example
Requires React 18.2+ or 19 and shared styles. See setup.
Default
Loading preview…
Code
'use client';
import { useState } from 'react';
import { Text } from '@swiftuijs/ui';
import { VStack } from '@swiftuijs/ui';
import { MultiDatePicker } from '@swiftuijs/ui';
function ControlledDemo() {
const [dates, setDates] = useState(['2026-04-10', '2026-04-12']);
return (<VStack spacing={16}>
<Text>Selected: {dates.join(', ')}</Text>
<MultiDatePicker label="Travel dates" value={dates} onValueChange={setDates}/>
</VStack>);
}
export default function Example() {
return (<ControlledDemo />);
}Status: adapted
Usage and limitations
valueanddefaultValueuse nativeYYYY-MM-DDdate stringsonValueChangereceives a normalized, ordered selection after every toggleminimumDateandmaximumDatemap to native input bounds- When
nameis provided, the control serializes each selected date as a repeated form field - Removing selected dates stays in the same control instead of opening a second editor
- Duplicate dates are collapsed automatically so the selection behaves like a date set, not a raw array
- Use ordered date arrays so selections remain deterministic across renders.
- Keep labels explicit because the control includes both a date entry field and a selected-date list.
- Prefer bounded ranges when the valid dates are known ahead of time.
More examples
Bounded Selections
API reference
| Prop | Type | Required | Description |
|---|---|---|---|
label | string | Yes | Accessible label rendered with the control. |
value | string[] | No | Controlled selected dates using native date input values. |
name | string | No | Optional form field name used for repeated hidden inputs. |
defaultValue | string[] | No | Uncontrolled selected dates using native date input values. |
onChange | ChangeEventHandler<HTMLInputElement> | No | Native change handler for the embedded date input. |
onValueChange | (value: string[]) => void | No | SwiftUI-style callback with the full selected date set. |
min | string | No | Native minimum selectable value. |
max | string | No | Native maximum selectable value. |
minimumDate | string | No | SwiftUI-style minimum alias. |
maximumDate | string | No | SwiftUI-style maximum alias. |
disabled | boolean | No | Disables date entry and chip removal. |
Inherits additional props from Omit<IBaseElementComponent<'div'>, 'children' | 'defaultValue' | 'onChange'>.