Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
DateField
The DateField component combines a text input with a DatePicker dropdown, giving merchants a compact way to select a single date. It supports common form field props (label, error, and change handlers) along with calendar navigation controls.
For multi-date or range selection, use DatePicker directly.
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Anchor to PropertiesProperties
Props for the DateField component, which combines a text input with a calendar picker for date selection. Text input props (like label, value, , and error) come from , while calendar navigation props (like , disabled, and ) come from .
- Anchor to labellabellabelstringstringrequiredrequired
The text content to display as the field's label. This label is always required for accessibility as it tells users what information the field expects. The label is rendered visually above the field.
- Anchor to defaultYearMonthdefaultYearMonthdefaultYearMonth{year: Year; month: Month} | YearMonthString{year: Year; month: Month} | YearMonthString
The year and month to display when the calendar first renders. Use this for an uncontrolled calendar that manages its own navigation state. This prop is ignored when
is set (controlled mode).Accepts either an object (
{ year, month }) or astring.- Anchor to disableddisableddisabledDisabled | Disabled[] | booleanDisabled | Disabled[] | boolean
The dates that the user can't select.
: Disables a specific date, such as'2024-12-25'.Range: Disables a span of dates betweenstartandend. Omitstartorendfor an open-ended range.Day: Disables every occurrence of a weekday, such as'Sunday'.Disabled[]: An array combining any of the above.true: Disables the entire date picker.
- Anchor to errorerrorerrorstringstring
An error message to display below the field. When set, the field receives a specific stylistic treatment (typically a red border) to communicate problems that have to be resolved immediately. The string value is displayed as the error message.
Pass
undefinedor omit this prop to clear the error state.- Anchor to idididstringstring
A unique identifier for the field.
- Anchor to namenamenamestringstring
An identifier for the field that is unique within the nearest containing Form component.
- Anchor to onBluronBluronBlur() => void() => void
A callback fired when the field loses focus. This is useful for triggering validation after the user finishes interacting with the field, or for tracking which fields have been "touched" in a form.
- Anchor to onChangeonChangeonChange(value: string) => void(value: string) => void
A callback that fires when the user finishes editing the field, typically on blur. Only fires if the value changed. Update your state in this callback and pass the new value back through the
valueprop.This doesn't fire on every keystroke. Use
for real-time responses like clearing validation errors as the user types. Don't useto controlvaluebecause that can cause issues on lower-powered devices due to asynchronous rendering.- Anchor to onFocusonFocusonFocus() => void() => void
A callback fired when the field receives focus. This is useful for clearing errors, showing helper text, or tracking user interaction with form fields.
- Anchor to onInputonInputonInput(value: string) => void(value: string) => void
A callback that fires on every change the user makes in the field, including each keystroke. The callback receives the current value.
Use
for immediate responses like clearing validation errors as the user types. Don't use it to control the field'svalueprop. Usefor that instead.- Anchor to onYearMonthChangeonYearMonthChangeonYearMonthChange(yearMonth: { year: number; month: number; }) => void(yearMonth: { year: number; month: number; }) => void
A callback that fires when the user navigates to a different month or year (for example, by pressing the forward/back arrows). Receives an object with
yearandmonthproperties. When using controlled navigation (is set), you must update your state and pass the new value back through theprop.- Anchor to readOnlyreadOnlyreadOnlybooleanbooleanDefault: falseDefault: false
Whether the field is read-only. Unlike
disabled, a read-only field can still receive focus and its value is included when the form is submitted. Use this when the value should be visible and selectable but not editable, such as a computed total.- Anchor to valuevaluevalueTT
The current value for the field. If omitted, then the field will be empty. You should update this value in response to the
callback.- Anchor to yearMonthyearMonthyearMonth{year: Year; month: Month} | YearMonthString{year: Year; month: Month} | YearMonthString
The year and month currently displayed in the calendar. Use this prop together with
to control which month the user sees. When set, the calendar won't navigate on its own. You must update this value in response toto let the user browse months.Accepts either an object (
{ year, month }) or astring.
Year
A four-digit year number, for example `2024`.
numberMonth
A month number in the 1–12 range (1 = January, 12 = December).
numberYearMonthString
A year-and-month string in simplified ISO 8601 format (`YYYY-MM`), for example `'2024-12'`.
stringDisabled
A value that can be disabled in the date picker. Can be a specific `DateString`, a `Range` of dates, or a `Day` of the week.
DateString | Range | DayDateString
A date string in simplified ISO 8601 format (`YYYY-MM-DD`), for example `'2024-12-25'`.
stringRange
A date range with optional start and end boundaries. Used for range selection in the date picker or for disabling a span of dates. Omitting `start` or `end` creates an open-ended range.
- end
The last day (inclusive) of the selected range.
DateString - start
The first day (inclusive) of the selected range.
DateString
Day
A day of the week. Used in `disabled` to disable every occurrence of a specific weekday (for example, `'Sunday'` disables all Sundays).
'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday'Anchor to ExamplesExamples
Anchor to Schedule product launch dateSchedule product launch date
Schedule a product launch date and save it from an action modal. This example uses DateField to capture the date, with a Button that schedules the launch.
Schedule product launch date
 that schedules the launch.](https://cdn.shopify.com/shopifycloud/shopify-dev/production/assets/assets/images/templated-apis-screenshots/admin-extensions/2025-07/datefield-default-CzQx2cxW.png)
Schedule product launch date
React
import {useState} from 'react';
import {reactExtension, useApi, DateField, Button, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
const {data, close} = useApi('admin.product-details.action.render');
const productId = data.selected[0]?.id;
const [date, setDate] = useState('');
return (
<BlockStack>
<DateField
label="Product launch date"
name="launchDate"
value={date}
onChange={setDate}
/>
<Button
variant="primary"
onPress={async () => {
await fetch('/api/products/launch-date', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, launchDate: date}),
});
close();
}}
>
Schedule launch
</Button>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, DateField, Button, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root, api) => {
const {data, close} = api;
const productId = data.selected[0]?.id;
let launchDate = '';
const stack = root.createComponent(BlockStack);
const field = root.createComponent(DateField, {
label: 'Product launch date',
name: 'launchDate',
onChange: (value) => {
launchDate = value;
},
});
const saveButton = root.createComponent(
Button,
{
variant: 'primary',
onPress: async () => {
await fetch('/api/products/launch-date', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, launchDate}),
});
close();
},
},
'Schedule launch',
);
stack.appendChild(field);
stack.appendChild(saveButton);
root.appendChild(stack);
},
);Anchor to Validate future date selectionValidate future date selection
Validate that a selected date is in the future using the error prop. This example checks the expiration date against today's date on each change and displays an inline error for past dates, so merchants can only set valid expiry windows.
Validate future date selection
React
import {useState} from 'react';
import {reactExtension, useApi, DateField, Button, BlockStack, Text} from '@shopify/ui-extensions-react/admin';
function App() {
const {data, close} = useApi('admin.product-details.action.render');
const productId = data.selected[0]?.id;
const [date, setDate] = useState('');
const [error, setError] = useState(undefined);
return (
<BlockStack>
<Text fontWeight="bold">Product expiry</Text>
<DateField
label="Expiration date"
name="expiryDate"
value={date}
error={error}
onChange={(value) => {
setDate(value);
const selected = new Date(value);
const today = new Date();
setError(
selected <= today ? 'Expiry date must be in the future' : undefined,
);
}}
/>
<Button
variant="primary"
onPress={async () => {
if (date) {
await fetch('/api/products/expiry', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, expiryDate: date}),
});
close();
}
}}
>
Set expiry date
</Button>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.action.render',
() => <App />,
);TS
import {extension, DateField, Button, BlockStack, Text} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.action.render',
(root, api) => {
const {data, close} = api;
const productId = data.selected[0]?.id;
let expiryDate = '';
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Product expiry',
);
const field = root.createComponent(DateField, {
label: 'Expiration date',
name: 'expiryDate',
onChange: (value) => {
expiryDate = value;
const selected = new Date(value);
const today = new Date();
if (selected <= today) {
field.updateProps({error: 'Expiry date must be in the future'});
} else {
field.updateProps({error: undefined});
}
},
});
const saveButton = root.createComponent(
Button,
{
variant: 'primary',
onPress: async () => {
if (expiryDate) {
await fetch('/api/products/expiry', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({productId, expiryDate}),
});
close();
}
},
},
'Set expiry date',
);
stack.appendChild(heading);
stack.appendChild(field);
stack.appendChild(saveButton);
root.appendChild(stack);
},
);Anchor to Display read-only date referencesDisplay read-only date references
Display historical dates as read-only reference fields using the readOnly prop. This example shows the product creation date and last warehouse sync date as non-editable fields, providing merchants with timeline context in a block extension.
Display read-only date references
React
import {reactExtension, DateField, BlockStack, Text} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<BlockStack>
<Text fontWeight="bold">Important dates</Text>
<DateField label="Date created" name="dateCreated" value="2024-01-15" readOnly />
<DateField label="Last warehouse sync" name="lastSync" value="2024-03-20" readOnly />
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, DateField, BlockStack, Text} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack);
const heading = root.createComponent(
Text,
{fontWeight: 'bold'},
'Important dates',
);
const createdField = root.createComponent(DateField, {
label: 'Date created',
name: 'dateCreated',
value: '2024-01-15',
readOnly: true,
});
const lastSyncField = root.createComponent(DateField, {
label: 'Last warehouse sync',
name: 'lastSync',
value: '2024-03-20',
readOnly: true,
});
stack.appendChild(heading);
stack.appendChild(createdField);
stack.appendChild(lastSyncField);
root.appendChild(stack);
},
);Anchor to Best practicesBest practices
- Use DateField for single-date selection in forms: DateField combines the familiar text input pattern with a calendar dropdown, making it ideal for form layouts where space is limited.
- Write a clear label: The required
labelprop tells merchants what date to select. Use specific labels like "Start date", "Ship by date", or "Event date".
Anchor to LimitationsLimitations
- The text input portion of DateField expects dates in YYYY-MM-DD format. Other date formats entered manually might not be parsed correctly.
- DateField doesn't support time selection. If you need date and time, you must combine DateField with a separate time input.