Skip to content

InputDate

Use InputDate to capture a date in a form. It builds on the Input component, adding date entry and field-specific validation.

The SDK InputDate showing a date entry field.
import { InputDate } from '/@dropins/tools/components.js';
PropTypeReq?Description
labelstringNoDisplayed field label.
namestringNoForm field identifier.
valuestringNoThe date value in YYYY-MM-DD format (for example, 2023-07-29). Displayed to the shopper in their browser’s locale format (for example, 07/29/2023 in en-US).
errorstringNoField-specific error message.

InputDate inherits the remaining Input props (such as onChange, onBlur, disabled, and placeholder), except error and value, which it redefines above.

import { InputDate, provider } from '/@dropins/tools/components.js';
await provider.render(InputDate, {
name: 'birthdate',
label: 'Birthdate',
value: '2023-07-29',
onChange: (event) => yourSaveBirthdate(event.target.value),
})(document.querySelector('.birthdate'));
  • Input — the base text input InputDate extends.
  • Field — wraps inputs with labels and validation messages.