- Implementation
- DateFieldYearless Props
- DateFieldYearlessChange
Common Examples
Default values
Default values can be included inDateFieldYearless to use the field in an uncontrolled mode.Controlled usage
TheDateFieldYearless can be controlled. This means you can maintain the state outside the component. Listen for new dates with onChange and supply a date into the value prop.Validation
Understanding the object passed back inonChange is key to understanding how to validate this field.isValid will tell you if the field can be parsed into a valid month and day and if it meets the criteria of minDate, maxDate, required, and unavailable.isInputValid will tell you only if the underlying input is parseable into a month and a day — this does not consider whether the date is good according the other props.isInputEmpty will tell you if the underlying input has no digits entered.Disabled hint text
The hint text can be disabled. If the hint text is disabled, ensure that the date format is displayed on the page.Markdown in labels
Thelabel prop supports inline markdown: bold (**text**), italic (*text*), bold and italic (***text***), highlight (==text==), and code (`text`).Hide the label
UsehideLabel to visually hide the label. The label string is converted to an aria-label on the input so it remains accessible to screen readers — any inline markdown is stripped to plain text.Testing
The field’s interactive sub-elements carry a stabledata-anv-part attribute so end-to-end tests can target them directly. The library owns the part names; you supply the instance identifier.Attach your own data-* attribute (such as data-cy or data-testid) to the field. It is forwarded to the masked text input — the one element present in every mode, including disablePicker:The popover and lists render in the browser’s top layer, outside the input’s subtree, so a descendant query scoped to your
data-cy on the input will not reach them. Target them by their part attribute directly. Only one picker is open at a time.