Migrate to the Polaris date picker component
The Polaris date picker component displays a calendar for selecting dates, date ranges, or multiple dates. It replaces the previous DatePicker component and is available as <s-date-picker> in API versions 2025-10 and newer.
Anchor to Updated propertiesUpdated properties
The following properties are different in the Polaris date picker component.
Anchor to selectedselected
The previous DatePicker selected prop has been split into type and either defaultValue (uncontrolled) or value (controlled).
If you were using selected with state and onChange to control the picker, use value instead of defaultValue to keep the component controlled.
| Previous pattern | New pattern (uncontrolled) | New pattern (controlled) |
|---|---|---|
selected="2024-12-25" | type="single" + defaultValue="2024-12-25" | type="single" + value="2024-12-25" |
selected={['2024-12-24', '2024-12-25']} | type="multiple" + defaultValue="2024-12-24,2024-12-25" | type="multiple" + value="2024-12-24,2024-12-25" |
selected={{start: '2024-12-24', end: '2024-12-31'}} | type="range" + defaultValue="2024-12-24--2024-12-31" | type="range" + value="2024-12-24--2024-12-31" |
Migrating selected (controlled)
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
import {useState} from 'preact/hooks';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
const [range, setRange] = useState('2024-12-24--2024-12-31');
return (
<s-date-picker
type="range"
value={range}
onChange={(event) => setRange(event.currentTarget.value)}
/>
);
}Pre-Polaris (2025-07)
import {useState} from 'react';
import {
reactExtension,
DatePicker,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
const [range, setRange] = useState({
start: '2024-12-24',
end: '2024-12-31',
});
return (
<DatePicker
selected={range}
onChange={(newRange) => setRange(newRange)}
/>
);
}Anchor to yearMonthyear Month
The previous DatePicker yearMonth prop is now called view. It takes a YYYY-MM string instead of a {year, month} object.
The previous DatePicker defaultYearMonth prop is now called defaultView. It takes a YYYY-MM string.
Anchor to disableddisabled
The previous disabled prop behavior has changed. Setting disabled to true still disables the entire picker. For disabling specific dates or days, use the new disallow and disallowDays props.
| Previous pattern | New pattern | Migration notes |
|---|---|---|
disabled={true} | disabled | No change needed. |
disabled={['2024-12-25', '2024-12-26']} | disallow="2024-12-25,2024-12-26" | Specific dates use comma-separated string in disallow. |
disabled={['Sunday', 'Saturday']} | disallowDays="sunday,saturday" | Days of week use disallowDays. |
disabled={[{start: '2024-12-01', end: '2024-12-10'}]} | disallow="2024-12-01--2024-12-10" | Date ranges use double-dash separator. |
Migrating disabled dates
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-date-picker
type="single"
defaultValue="2024-12-15"
disallow="2024-12-25,2024-12-26"
disallowDays="saturday,sunday"
/>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
DatePicker,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<DatePicker
selected="2024-12-15"
disabled={[
'2024-12-25',
'2024-12-26',
'Saturday',
'Sunday',
]}
/>
);
}Anchor to onChangeon Change
The previous onChange prop is still available as onChange. It fires when the user finishes editing — for type="range", this means after the end date is selected. The Polaris date picker also introduces onInput, which fires on every individual date selection. Use onChange for committed values and onInput when you need to react to each selection.
The previous onYearMonthChange prop is now called onViewChange.
Anchor to Removed propertiesRemoved properties
Anchor to readOnlyread Only
The Polaris date picker component no longer supports readOnly. Use disabled instead.
Anchor to New propertiesNew properties
The Polaris date picker component introduces the following new properties:
| New prop | Type | Description |
|---|---|---|
type | 'single' | 'multiple' | 'range' | Selection mode. Default: 'single'. |
allow | string | Comma-separated list of allowed dates. |
allowDays | string | Comma-separated list of allowed days. |
disallow | string | Comma-separated list of disallowed dates. |
disallowDays | string | Comma-separated list of disallowed days. |