--- title: Date field description: >- The date field component captures date input with a consistent interface for date selection and proper validation. Use it to collect date information in forms, scheduling interfaces, or data entry workflows. The component supports manual text entry. For visual calendar-based selection, consider using [date picker](/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-picker) or [date spinner](/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-spinner) components. api_version: 2025-10 api_name: pos-ui-extensions source_url: html: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-field md: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-field.md --- # Date field The date field component captures date input with a consistent interface for date selection and proper validation. Use it to collect date information in forms, scheduling interfaces, or data entry workflows. The component supports manual text entry. For visual calendar-based selection, consider using [date picker](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-picker) or [date spinner](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-spinner) components. ### Support Targets (9) ### Supported targets * [pos.​cart.​line-item-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/cart-details#cart-details-action-modal-) * [pos.​customer-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/customer-details#customer-details-action-modal-) * [pos.​draft-order-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/draft-order-details#draft-order-details-action-modal-) * [pos.​exchange.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/post-exchange#post-exchange-action-modal-) * [pos.​home.​modal.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/home-screen#home-screen-action-modal-) * [pos.​order-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/order-details#order-details-action-modal-) * [pos.​product-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/product-details#product-details-action-modal-) * [pos.​purchase.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/post-purchase#post-purchase-action-modal-) * [pos.​return.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/targets/post-return#post-return-action-modal-) #### Use cases * **Scheduling:** Collect appointment dates, delivery dates, or scheduling information. * **Transaction dates:** Capture transaction dates or expiration dates in financial interfaces. * **Filtering:** Provide date-based filtering controls for reports or transaction histories. * **Validation:** Support form submissions with proper date validation. ## Examples ### Capture date input with a date field Capture date input using a date field component with built-in validation and picker integration. This example shows a basic date field with label and placeholder text. ## Capture date input with a date field ![](https://cdn.shopify.com/shopifycloud/shopify-dev/development/assets/assets/images/templated-apis-screenshots/pos-ui-extensions/2025-10/date-field-default-C-zMSYMx.png) ### Handle date selection events Subscribe to date input events to respond when merchants select or enter dates. This example shows how to handle `onChange` events to capture date selections, enabling real-time validation, date range checks, or dynamic scheduling behavior based on merchant input. ### Examples * #### Capture date input with a date field ##### Description Capture date input using a date field component with built-in validation and picker integration. This example shows a basic date field with label and placeholder text. ##### Default ```html ``` * #### Handle date selection events ##### Description Subscribe to date input events to respond when merchants select or enter dates. This example shows how to handle \`onChange\` events to capture date selections, enabling real-time validation, date range checks, or dynamic scheduling behavior based on merchant input. ##### Default ```jsx console.log('Input:', event.currentTarget.value)} onChange={(event) => console.log('Change:', event.currentTarget.value)} onFocus={(event) => console.log('Focused with:', event.currentTarget.value)} onBlur={(event) => console.log('Blurred with:', event.currentTarget.value)} /> ``` ## Properties Configure the following properties on the date field component. * **details** **string** The additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user. This will also be exposed to screen reader users. * **disabled** **boolean** **Default: false** Whether the field is disabled, preventing user interaction. Use when the field is temporarily unavailable due to application state, permissions, or dependencies. * **error** **string** An error message to indicate a problem to the user. The field will be given specific stylistic treatment to communicate issues that must be resolved immediately. * **id** **string** A unique identifier for the element used for targeting with CSS, JavaScript, or accessibility features. * **label** **string** The content to use as the field label that describes the date information being requested. * **value** **string** The currently selected date value in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DD`, for example, `"2024-05-15"`). An empty string means no date is selected. Other date formats require conversion before setting this property. Validation occurs when the user finishes editing (on blur), rather than on every keystroke, so invalid dates are flagged after completing entry. ## Events The date field component provides event callbacks for handling user interactions. Learn more about [handling events](https://shopify.dev/docs/api/polaris/using-polaris-web-components#handling-events). * **blur** **(event: CallbackEvent<"s-date-field">) => void** Called when the element loses focus. * **change** **(event: CallbackEvent<"s-date-field">) => void** Called after editing completes, typically on blur. * **focus** **(event: CallbackEvent<"s-date-field">) => void** Called when the element receives focus. * **input** **(event: CallbackEvent<"s-date-field">) => void** Called when the user makes any changes in the field. ### CallbackEvent Represents the event object passed to callback functions when interactive events occur. Contains metadata about the event, including the target element, event phase, and propagation behavior. * bubbles Whether the event bubbles up through the DOM tree. ```ts boolean ``` * cancelable Whether the event can be canceled. ```ts boolean ``` * composed Whether the event will trigger listeners outside of a shadow root. ```ts boolean ``` * currentTarget The element that the event listener is attached to. ```ts HTMLElementTagNameMap[T] ``` * detail Additional data associated with the event. ```ts any ``` * eventPhase The current phase of the event flow. ```ts number ``` * target The element that triggered the event. ```ts HTMLElementTagNameMap[T] | null ``` ## Best practices * **Choose for direct text input:** Use date field when users know the exact date and can type it efficiently. Use [date picker](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-picker) for calendar selection or [date spinner](https://shopify.dev/docs/api/pos-ui-extensions/2025-10/polaris-web-components/forms/date-spinner) for space-constrained layouts. * **Explain date constraints:** Use `details` to clarify requirements like "Select a date within the next 30 days" or "Must be a future date." * **Write actionable error messages:** Provide clear validation messages for invalid dates that help users correct their input.