Migrate to the Polaris date field component
The Polaris date field component provides a text input with a calendar picker for selecting dates. It replaces the previous DateField component and is available as <s-date-field> in API versions 2025-10 and newer.
Anchor to Updated propertiesUpdated properties
The following properties are different in the Polaris date field component.
Anchor to readonlyreadonly
The previous DateField readonly prop is now called readOnly (camelCase).
Anchor to yearMonthyear Month
The previous DateField yearMonth prop is now called view. It takes a YYYY-MM string instead of a {year, month} object.
The previous DateField 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 field. 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-field
label="Select delivery date"
defaultValue="2024-12-15"
disallowDays="saturday,sunday"
/>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
DateField,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<DateField
label="Select delivery date"
value="2024-12-15"
disabled={['Saturday', 'Sunday']}
/>
);
}The previous onYearMonthChange prop is now called onViewChange.
Migrating onYearMonthChange to onViewChange
Latest (Preact)
import '@shopify/ui-extensions/preact';
import {render} from 'preact';
export default function extension() {
render(<Extension />, document.body);
}
function Extension() {
return (
<s-date-field
label="Select date"
defaultValue="2024-12-15"
view="2024-12"
onViewChange={(event) => console.log('View changed', event)}
/>
);
}Pre-Polaris (2025-07)
import {
reactExtension,
DateField,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
return (
<DateField
label="Select date"
value="2024-12-15"
yearMonth={{year: 2024, month: 12}}
onYearMonthChange={({year, month}) =>
console.log('View changed', year, month)
}
/>
);
}Anchor to Removed propertiesRemoved properties
The following properties aren't supported:
placeholder— no longer supported, uselabelinstead.
Anchor to New propertiesNew properties
The Polaris date field component introduces the following new properties:
| New prop | Type | Description |
|---|---|---|
allow | string | Comma-separated list of allowed dates (whitelist). |
allowDays | string | Comma-separated list of allowed days of the week. |
disallow | string | Comma-separated list of disallowed dates. |
disallowDays | string | Comma-separated list of disallowed days of the week. |
required | boolean | Whether the field is required. |
autocomplete | string | Autocomplete attribute for the input. |