Date input
Date input
Component demo
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input>
Date input details
Props
All components also accept native properties supported by the DOM, such asclassName
and
style
.
|
|
|
---|---|---|
|
The label for the date input. |
|
|
The format in which the date will be displayed. |
|
|
The days of the week to disable. |
|
|
The text to display as the validation message when |
|
|
If |
|
|
The text to display as the validation message when |
|
|
If |
|
|
The text to display as the validation message when |
|
|
If |
|
|
If |
|
|
The helper text that will be displayed for additional field guidance. This will default to the text "Use format" along with the |
|
|
If |
|
|
If |
|
|
The ID for the input. |
|
|
The text to display as the validation message when an invalid date is entered. |
|
|
The latest date that will be allowed. The value can be in any format supported as |
|
|
The earliest date that will be allowed. The value can be in any format supported as |
|
|
The name of the control, which is submitted with the form data. |
|
|
If |
|
|
If |
|
|
The size of the date input to be displayed. |
|
|
Sets the date picker to the dark or light theme colors. "inherit" will set the color based on the system settings or ic-theme component. |
|
|
The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation. |
|
|
The text to display as the validation message. This will override the built-in date validation. |
|
|
The value of the date input. The value can be in any format supported as |
|
The label for the date input. |
The format in which the date will be displayed. |
The days of the week to disable. |
The text to display as the validation message when |
If |
The text to display as the validation message when |
If |
The text to display as the validation message when |
If |
If |
The helper text that will be displayed for additional field guidance. This will default to the text "Use format" along with the |
If |
If |
The ID for the input. |
The text to display as the validation message when an invalid date is entered. |
The latest date that will be allowed. The value can be in any format supported as |
The earliest date that will be allowed. The value can be in any format supported as |
The name of the control, which is submitted with the form data. |
If |
If |
The size of the date input to be displayed. |
Sets the date picker to the dark or light theme colors. "inherit" will set the color based on the system settings or ic-theme component. |
The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation. |
The text to display as the validation message. This will override the built-in date validation. |
The value of the date input. The value can be in any format supported as |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a
slot
attribute on the slotted content.
|
|
---|---|
|
|
|
Events
All components also accept native events supported by the DOM, such as
onClick
and
onKeyDown
.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
|
|
|
---|---|---|
|
|
|
|
Variants
With values
String
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"value="21/01/2001"></ic-date-input>
Date object
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input>
Zulu datetime
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input>
String with hyphens
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input>
Epoch date
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input>
Required
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"required="true"></ic-date-input>
Hide label
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"hide-label="true"></ic-date-input>
Disabled
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"disabled="true"></ic-date-input>
Sizes
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"size="small"></ic-date-input><ic-date-inputlabel="When would you like to collect your coffee?"></ic-date-input><ic-date-inputlabel="When would you like to collect your coffee?"size="large"></ic-date-input>
Custom helper text
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"helper-text="We will have your order ready for you on this date"></ic-date-input>
Hide helper text
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"helper-text="We will have your order ready for you on this date"hide-helper-text="true"></ic-date-input>
Custom validation
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"validation-status="error"validation-text="There is a coffee shortage forecast for that day. Please choose a different date."></ic-date-input><ic-date-inputlabel="When would you like to collect your coffee?"validation-status="warning"validation-text="Please be aware that there may be a coffee shortage on that day."></ic-date-input><ic-date-inputlabel="When would you like to collect your coffee?"validation-status="success"validation-text="Your coffee will be available for you to collect on this day."></ic-date-input>
Disabled past dates
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"disable-past="true"></ic-date-input>
Disabled future dates
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"disable-future="true"></ic-date-input>
Min and max
Interactive example
<ic-date-inputlabel="When would you like to collect your coffee?"min="02/01/2023"max="20-07-2023"></ic-date-input>
Form
Interactive example
<form><ic-date-inputlabel="When would you like to collect your coffee?"value="13/03/1951"></ic-date-input><ic-buttontype="submit"value="Submit"></ic-button><ic-buttontype="reset"value="Reset"></ic-button></form>
With clearing value
Interactive example
<ic-date-inputid="date-input-clear-value"label="When would you like to collect your coffee?"date-format="DD/MM/YYYY"value="21/01/2001"></ic-date-input><ic-buttonid="update">Update date</ic-button><ic-buttonid="null-btn">set null</ic-button><ic-buttonid="empty-btn">set empty string</ic-button><ic-buttonid="undef-btn">set undefined</ic-button>