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

  • value and defaultValue use native YYYY-MM-DD date strings
  • onValueChange receives a normalized, ordered selection after every toggle
  • minimumDate and maximumDate map to native input bounds
  • When name is 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
  1. Use ordered date arrays so selections remain deterministic across renders.
  2. Keep labels explicit because the control includes both a date entry field and a selected-date list.
  3. Prefer bounded ranges when the valid dates are known ahead of time.

More examples

Bounded Selections

API reference

PropTypeRequiredDescription
labelstringYesAccessible label rendered with the control.
valuestring[]NoControlled selected dates using native date input values.
namestringNoOptional form field name used for repeated hidden inputs.
defaultValuestring[]NoUncontrolled selected dates using native date input values.
onChangeChangeEventHandler<HTMLInputElement>NoNative change handler for the embedded date input.
onValueChange(value: string[]) => voidNoSwiftUI-style callback with the full selected date set.
minstringNoNative minimum selectable value.
maxstringNoNative maximum selectable value.
minimumDatestringNoSwiftUI-style minimum alias.
maximumDatestringNoSwiftUI-style maximum alias.
disabledbooleanNoDisables date entry and chip removal.

Inherits additional props from Omit<IBaseElementComponent<'div'>, 'children' | 'defaultValue' | 'onChange'>.