# DateField A component that enables users to open a dialog and select a date through a text input. ```tsx import React, {useState} from 'react'; import { DateField, Screen, ScrollView, Navigator, Text, reactExtension, } from '@shopify/ui-extensions-react/point-of-sale'; const SmartGridModal = () => { const [date, setDate] = useState(''); return ( setDate(''), }} /> Selected Date: {date} ); }; export default reactExtension('pos.home.modal.render', () => ( )); ``` ```ts import { Navigator, Screen, ScrollView, Text, DateField, extension, } from '@shopify/ui-extensions/point-of-sale'; export default extension('pos.home.modal.render', (root, api) => { const clearHandler = () => { dateField.updateProps({value: ''}); textBox.replaceChildren(''); }; const dateField = root.createComponent(DateField, { label: 'Select Date', value: '', action: {label: 'Clear', onPress: clearHandler}, }); const textBox = root.createComponent(Text); const onChangeHandler = (newValue: string) => { dateField.updateProps({value: newValue}); const textContent = `Selected Date: ${newValue}`; textBox.replaceChildren(textContent); }; dateField.updateProps({onChange: onChangeHandler}); const scrollView = root.createComponent(ScrollView); scrollView.append(dateField); scrollView.append(textBox); const screen = root.createComponent(Screen, { name: 'DateField', title: 'Date Field Example', }); screen.append(scrollView); const navigator = root.createComponent(Navigator); navigator.append(screen); root.append(navigator); }); ``` ## DateField ### DateFieldProps ### disabled value: `boolean` Whether the field can be modified. ### error value: `string` Indicates an error to the user. The field is given specific stylistic treatment to communicate problems that have to be resolved immediately. ### label value: `string` The content to use as the field label. ### onBlur value: `() => void` The callback when focus is removed. ### onChange value: `(value: string) => void` The callback when the user has finished editing a field. ### onFocus value: `() => void` The callback when input is focused. ### value value: `string` The current value for the field. Defaults to now. You should update this value in response to the `onChange` callback. ### helpText value: `string` The label under the text field which provides guidance or instructions that assist users. ### action value: `InputAction` - InputAction: export interface InputAction { /** * The text displayed in the button. */ label: string; /** * A callback to be performed. */ onPress: () => void; /** * Whether the button can be pressed. */ disabled?: boolean; } A button under the text field to provide extra functionality. ### InputAction ### label value: `string` The text displayed in the button. ### onPress value: `() => void` A callback to be performed. ### disabled value: `boolean` Whether the button can be pressed.