-
Notifications
You must be signed in to change notification settings - Fork 17
Add date time component usage guides #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kathrinschalber
wants to merge
22
commits into
development-5.0.0
Choose a base branch
from
docs/date-time-components-guides
base: development-5.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+326
β28
Open
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7918199
Create guide.mdx
kathrinschalber 69a303e
added date time input files
kathrinschalber fc768da
Added actual Figma illustrations on date picker
kathrinschalber 50f7784
added date picker images
kathrinschalber b69e882
Add date-time picker docs and update related guides
kathrinschalber 5e1a501
Update related links in date and time component guides
kathrinschalber 4de324b
Update date/time picker docs and add accessibility reference
kathrinschalber 5f6227f
Fix broken links in date-time picker guide
kathrinschalber fdd89ba
Remove unnecessary additional intro sentence
kathrinschalber 46c56a9
Update documentation links for form and picker options
kathrinschalber 4556a5f
Applied feedback from review
kathrinschalber d582bac
fixed link
kathrinschalber 95f84b5
Merge branch 'main' into docs/date-time-components-guides
kathrinschalber 11ee300
Applied feedback from dev and final edit
kathrinschalber 1d0e897
feat: add datetime-input examples
alexkaduk 64b10d2
feat: add datetime-input examples
alexkaduk f55db0c
Merge branch 'main' into docs/date-time-components-guides
alexkaduk b4ad6dd
feat: add datetime-input examples
alexkaduk 82c4d45
feat: add datetime-input examples
alexkaduk 619449f
feat: add datetime-input examples
alexkaduk 25a88ec
Merge branch 'main' into docs/date-time-components-guides
alexkaduk 57e29eb
Update wEptRgAezDU1z80Cn3eZ0o_7441_86123.png
kathrinschalber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Point to ix repo PR #2359 with the datetime-input component | ||
| DOCS_BRANCH='docs/date-time-components-guides' | ||
| DOCS_BRANCH_TYPE='pull request' | ||
| DOCS_PR_NUMBER='2359' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| --- | ||
|
|
||
| # Date picker - Usage | ||
|
|
||
|  | ||
|
|
||
| 1. Month and year navigation | ||
| 2. Weekday labels | ||
| 3. Week numbers | ||
| 4. Selected date or date range | ||
| 5. Confirm [button](../button) | ||
|
|
||
| ## Options | ||
|
|
||
| - **Value**: Defines the selected date or date range. | ||
| - **Single selection**: By default, users select date ranges. Use single selection to allow selecting a single date. | ||
| - **Format**: Define the date format that determines how dates are displayed, e.g. `yyyy/LL/dd` for `2024/06/15`. | ||
| - **Week start**: Define which day the week starts on. By default, it will be defined based on the locale. | ||
| - **Week numbers**: Show calendar weeks on the left side of the calendar when needed for reference. | ||
| - **Min and max dates**: Restrict the selectable date range by defining the earliest and latest dates users can choose. | ||
| - **Corners**: By default, date pickers show rounded corners to be consistent with the [dropdown](../dropdown). Use straight, left or right corners to combine with other components. | ||
|
|
||
| ## Behavior in context | ||
|
|
||
| - **Range selection**: In range mode users select a start date and then an end date. The time period between both dates is visually highlighted to provide clear feedback. | ||
| - **Month navigation**: Users can navigate between months using the arrow buttons in the header or the dropdown menu to quickly jump to a specific month and year. | ||
| - **Interaction**: Users can navigate through the date picker using the keyboard. The following keys are supported: | ||
| - **Tab**: Navigate between areas of the date picker (header, body, footer). | ||
| - **Arrow keys**: Move through dates in the calendar. | ||
| - **Enter or click**: Select the highlighted date. | ||
| - **Escape**: Close date pickers when used in a dropdown. If header dropdown for month/year selection is open, it closes first. | ||
|
|
||
| ## States | ||
|
|
||
| Individual calendar dates within a date picker have five states: Default, hover, active, disabled and focused. Dates outside the allowed range appear in a disabled state and cannot be selected. | ||
|
|
||
|  | ||
|
|
||
| ## Dos and Donβts | ||
|
|
||
| <div class="dos-and-donts" markdown> | ||
| <div class="dos" markdown> | ||
|
|
||
| - Do use date pickers to ensure accurate date selection | ||
| - Do provide clear labels when the date picker is used in a form context | ||
| - Do ensure the date picker is accessible via keyboard navigation | ||
| - Do use range selection for date periods like booking dates or report timeframes | ||
| - Do set min and max dates to prevent invalid date selections | ||
|
|
||
| </div> | ||
| <div class="donts" markdown> | ||
|
|
||
| - Donβt use date pickers for dates that are far in the past or future, use [date inputs](../input) instead | ||
| - Donβt clutter the date picker interface with unnecessary options | ||
| - Donβt forget to handle empty or invalid date states in your validation logic | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| ## Related | ||
|
|
||
| - [Date input](../input-date) | ||
| - [Date time picker](../date-time-picker) | ||
| - [Time picker](../time-picker) | ||
| - [Writing guidelines for date and time](../../guidelines/language/formatting/date.mdx) | ||
| - [W3C date picker accessibility reference](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-datepicker/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| --- | ||
|
|
||
| # Date time picker - Usage | ||
|
|
||
|  | ||
|
|
||
| 1. [Date picker](../date-picker) | ||
| 2. [Time picker](../time-picker) | ||
| 3. Confirm [button](../button) | ||
|
|
||
| ## Options | ||
kathrinschalber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - **Value**: See [date picker](../date-picker/guide#options) and [time picker](../time-picker/guide#options). | ||
| - **Single selection**: See [date picker](../date-picker/guide#options). | ||
| - **Format**: Choose the date and time format, e.g. `yyyy/LL/dd` and `HH:mm:ss`. | ||
| - **Min and max dates**: See [date picker](../date-picker/guide#options). | ||
| - **Date picker appearance**: See [date picker](../date-picker/guide#options). | ||
| - **Week start**: Define which day the week starts on. By default, it will be defined based on the locale. | ||
| - **Week numbers**: Show calendar weeks on the left side of the calendar when needed for reference. | ||
| - **Time picker appearance**: See [time picker](../time-picker/guide#options). | ||
| - **Time reference**: Show time reference input for AM/PM notation when using 12-hour time format. | ||
| - **Header**: Customize the header of the time picker. | ||
| - **Corners**: By default, date time pickers show rounded corners to be consistent with the [dropdown](../dropdown). Use straight, left or right corners to combine with other components. | ||
|
|
||
| ## Behavior in context | ||
|
|
||
| - **Combined selection**: Users select both a date and a time before confirming their choice. The selection is only finalized when the confirmation button is clicked. | ||
| - **Range selection**: Range mode allows users to select a start and end date while using one shared time value for both. If start and end need different times, use two separate date time pickers instead. | ||
| - **Month navigation**: Users can navigate between months using the previous and next buttons in the header. This allows quick access to dates outside the current view. | ||
| - **Interaction**: Users can navigate through the date time picker using the keyboard. The following keys are supported: | ||
| - **Tab**: Navigate between areas of the picker (header, body, time input, footer). | ||
| - **Arrow keys**: Move through dates in the date picker and times in the time picker. | ||
| - **Enter or click**: Select the highlighted date or time. | ||
| - **Escape**: Close the date time picker when used in a dropdown. If the header dropdown for month/year selection is open, it closes first. | ||
|
|
||
| ## States | ||
|
|
||
| Individual calendar dates within a date time picker have five states: Default, hover, active, disabled and focused. Dates outside the allowed range appear in a disabled state and cannot be selected (see [date picker](../date-picker/guide#states) and [time picker](../time-picker/guide#states) for reference). | ||
|
|
||
| ## Dos and Donβts | ||
|
|
||
| <div class="dos-and-donts" markdown> | ||
| <div class="dos" markdown> | ||
|
|
||
| - Do use date time pickers when both date and time information are required | ||
| - Do ensure the date time picker is accessible via keyboard navigation | ||
| - Do use range selection for time periods like booking appointments or scheduling events | ||
| - Do set appropriate min and max dates to prevent invalid selections | ||
|
|
||
| </div> | ||
| <div class="donts" markdown> | ||
|
|
||
| - Donβt use date time pickers when only a date or only a time is needed (use [date pickers](../date-picker) or [time pickers](../time-picker) instead) | ||
| - Donβt forget to validate both date and time inputs in your form logic | ||
| - Donβt use date time pickers for dates that are far in the past or future without setting appropriate min and max constraints | ||
| - Donβt clutter the interface with unnecessary time precision when approximate times are sufficient | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| ## Related | ||
|
|
||
| - [Date picker](../date-picker) | ||
| - [Time picker](../time-picker) | ||
| - [Date time input](../input-date-time) | ||
| - [Writing guidelines for date and time](../../guidelines/language/formatting/date.mdx) | ||
| - [W3C date picker accessibility reference](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-datepicker/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| formReady: true | ||
| --- | ||
| import DatetimeInputPlayground from '@site/docs/autogenerated/playground/datetime-input.mdx'; | ||
| import DatetimeInputDisabledPlayground from '@site/docs/autogenerated/playground/datetime-input-disabled.mdx'; | ||
| import DatetimeInputLabelPlayground from '@site/docs/autogenerated/playground/datetime-input-label.mdx'; | ||
| import DatetimeInputReadonlyPlayground from '@site/docs/autogenerated/playground/datetime-input-readonly.mdx'; | ||
| import DatetimeInputValidationPlayground from '@site/docs/autogenerated/playground/datetime-input-validation.mdx'; | ||
| import DatetimeInputWithSlotsPlayground from '@site/docs/autogenerated/playground/datetime-input-with-slots.mdx'; | ||
| import DatetimeInputMinMaxDatePlayground from '@site/docs/autogenerated/playground/datetime-input-min-max-date.mdx'; | ||
| import PropsApi from '@site/docs/autogenerated/api/ix-datetime-input/api.mdx'; | ||
|
|
||
| # Date time input - Code | ||
|
|
||
| ## Basic | ||
|
|
||
| <DatetimeInputPlayground height="28rem" /> | ||
kathrinschalber marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Disabled | ||
|
|
||
| <DatetimeInputDisabledPlayground /> | ||
|
|
||
| ## Label | ||
|
|
||
| <DatetimeInputLabelPlayground height="28rem" /> | ||
flxlst09 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Readonly | ||
|
|
||
| <DatetimeInputReadonlyPlayground /> | ||
|
|
||
| ## Validation | ||
|
|
||
| <DatetimeInputValidationPlayground height="40rem" /> | ||
|
|
||
| ## Slots | ||
|
|
||
| <DatetimeInputWithSlotsPlayground height="28rem" /> | ||
|
|
||
| ## Min- and max-date | ||
|
|
||
| <DatetimeInputMinMaxDatePlayground height="28rem" /> | ||
flxlst09 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <PropsApi /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| formReady: true | ||
| --- | ||
|
|
||
| # Date time input - Usage | ||
|
|
||
|  | ||
|
|
||
| 1. Label | ||
| 2. Required field indicator | ||
| 3. Current date and time value | ||
| 4. Calendar [icon button](../icon-button) | ||
| 5. [Input field](../input) | ||
| 6. [Date time picker](../date-time-picker) | ||
| 7. Month and year navigation | ||
| 8. Weekday labels | ||
| 9. Selected date or date range | ||
kathrinschalber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 10. Time picker | ||
| 11. Confirm [button](../button) | ||
kathrinschalber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Options | ||
|
|
||
| - **Label**: See [form field](../forms-field/guide#options). | ||
| - **Required**: See [form field](../forms-field/guide#options). | ||
| - **Helper text**: See [form field](../forms-field/guide#options). | ||
| - **Feedback text**: See [form field](../forms-field/guide#options). | ||
| - **Show text as tooltip**: See [form field](../forms-field/guide#options). | ||
| - **Placeholder**: See [form field](../forms-field/guide#options). We typically use a placeholder to show an example date time format to assist users when the field is empty. | ||
| - **Text alignment**: See [form field](../forms-field/guide#options) (by default at start). | ||
| - **Error message**: Feedback text when date or time is not parsable. We typically use this to inform users that the entered date time format is incorrect and guide them to enter a valid date and time. | ||
| - **Format**: Choose the date and time format, e.g. `yyyy/LL/dd` and `HH:mm:ss`. | ||
| - **Min and max dates**: Restrict the selectable date range by defining the earliest and latest dates users can choose. | ||
| - **Date time picker appearance**: See [date time picker](../date-time-picker/guide#options). | ||
flxlst09 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **Week start**: Define which day the week starts on. By default, it will be defined based on the locale. | ||
| - **Week numbers**: Show calendar weeks on the left side of the calendar when needed for reference. | ||
|
|
||
| ## Behavior in context | ||
|
|
||
| - **Interaction**: | ||
| - Click opens date time pickers. Via keyboard focus followed by arrow down key also opens it. | ||
| - Use mouse or keyboard arrows to navigate to the desired date and adjust the time. | ||
| - Confirm closes the date time picker and applies the selection. | ||
| - Typing a valid date and time into input field closes the picker. | ||
| - Escape key closes the date time picker. | ||
| - **Validation**: | ||
| - Use feedback text for validation types valid, info, warning and invalid. | ||
| - Invalid feedback is automatically provided if the entered date or time is not parsable. | ||
| - Refer to the [validation](../forms-validation) chapter for detailed guidelines. | ||
| - **Overflow**: The input field should be wide enough to display the full date and time without truncation. | ||
| - **Alignment**: Date time inputs are aligned to the left by default. | ||
| - **Combined selection**: Users select both a date and a time before confirming their choice. The selection is only finalized when the confirmation button is clicked. | ||
flxlst09 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## States | ||
|
|
||
| Date time input has five states: Default, hover, disabled, read-only and focused. | ||
|
|
||
|  | ||
|
|
||
| ## Dos and Don'ts | ||
|
|
||
| <div class="dos-and-donts" markdown> | ||
| <div class="dos" markdown> | ||
|
|
||
| - Do use consistent date and time formats throughout the application to avoid confusion | ||
| - Do provide clear instructions on the expected format, such as "Enter the date time in yyyy/mm/dd HH:mm format" | ||
kathrinschalber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Do consider localization to adapt date and time formats to local conventions | ||
| - Do use separate inputs for start and end date times when defining time ranges | ||
|
|
||
| </div> | ||
| <div class="donts" markdown> | ||
|
|
||
| - Don't use date time inputs when only a date or only a time is needed (use [date input](../input-date) or [time input](../input-time) instead) | ||
|
|
||
| </div> | ||
| </div> | ||
|
|
||
| ## Related | ||
|
|
||
| - [Time picker](../time-picker) | ||
| - [Date time picker](../date-time-picker) | ||
| - [Time input](../input-time) | ||
| - [Date input](../input-date) | ||
| - [Forms field](../forms-field) | ||
| - [Validation](../forms-validation) | ||
| - [Writing guidelines for date and time](../../guidelines/language/formatting/date.mdx) | ||
| - [W3C date picker accessibility reference](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-datepicker/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| doc-type: "tabs" | ||
| description: 'Date time input provides a versatile interface for selecting both date and time values, offering a seamless way to input date and time information either as a standalone element or within a dropdown.' | ||
| title: 'Date time input' | ||
| deprecated: | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.