timepicker
A timepicker is an autocomplete text input to capture a time.
- 6:00am
- 7:00am
- Current Selection: 8:00am
- 9:00am
- 10:00am
- 11:00am
- 12:00pm
- 1:00pm
- 2:00pm
- 3:00pm
- 4:00pm
- 5:00pm
About Timepicker
Implementation
A timepicker is used to select a single time. The component is using the combobox HTML structure and has the following markup requirements:
Desktop:
- Add
.slds-is-open
to the element with.slds-dropdown-trigger
to invoke the dropdown that contains the list of time options. - The
.slds-has-focus
modifier class is required on the.slds-listbox__option
element that has focus. - The
.slds-is-selected
modifier class is required on the.slds-listbox__option
element that has been selected.
Mobile:
- When on mobile, we want to leverage the native timepicker by changing the
input
type fromtext
totime
- When switching
input type="text"
toinput type="time"
for mobile, we need to remove the ARIA attributes. The native rendering doesn't require these.- On the element with the class
slds-combobox
, please removerole="combobox"
,aria-expanded
, andaria-haspopup
. - On the
input
that we just addedtype="time"
too, please removearia-controls
,aria-autocomplete
, androle="textbox"
.
- On the element with the class
Accessibility
Please follow the implementation guidelines found under Combobox
Base
- 6:00am
- 7:00am
- 8:00am
- 9:00am
- 10:00am
- 11:00am
- 12:00pm
- 1:00pm
- 2:00pm
- 3:00pm
- 4:00pm
- 5:00pm
<div class="slds-form-element">
<label class="slds-form-element__label" for="combobox-unique-id-75">Time</label>
<div class="slds-form-element__control">
States
Focused
- 6:00am
- 7:00am
- 8:00am
- 9:00am
- 10:00am
- 11:00am
- 12:00pm
- 1:00pm
- 2:00pm
- 3:00pm
- 4:00pm
- 5:00pm
<div class="slds-form-element">
<label class="slds-form-element__label" for="combobox-unique-id-78">Time</label>
<div class="slds-form-element__control">
Open - Item Focused
- 6:00am
- 7:00am
- 8:00am
- 9:00am
- 10:00am
- 11:00am
- 12:00pm
- 1:00pm
- 2:00pm
- 3:00pm
- 4:00pm
- 5:00pm
<div class="slds-form-element">
<label class="slds-form-element__label" for="combobox-unique-id-81">Time</label>
<div class="slds-form-element__control">
Open - Time selected
- 6:00am
- 7:00am
- Current Selection: 8:00am
- 9:00am
- 10:00am
- 11:00am
- 12:00pm
- 1:00pm
- 2:00pm
- 3:00pm
- 4:00pm
- 5:00pm
<div class="slds-form-element">
<label class="slds-form-element__label" for="combobox-unique-id-84">Time</label>
<div class="slds-form-element__control">