input time
The time input element let the user enter and edit a time.
The control's user interface varies from browser to browser. It was not styled by FROK (browser native behaviour).
The cross-browser input layout is different.
For Chrome/Opera and Microsoft Edge it is designed in FROK style. For Firefox, we use the browser-native look and feel.
Firefox also doesn't provide an interface to select the time. It has to be set directly in the input field.
According to the Web Content Accessibility Guidelines (WCAG), it is highly recommended to use a label together with the date input.
This component works with all its features only in browsers that have support for the
If you need to run this component in a browser with no support for the
:has
CSS selector. Please refer to the
reference on MDN.
If you need to run this component in a browser with no support for the
:has
CSS selector, please use the
FROK Release 3.6.x.
table of content
component variations
input time
<div class="a-time-input">
<input type="time" id="time-input-1" name="input time" />
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time readonly
<div class="a-time-input">
<input
type="time"
id="time-input-2"
name="input time readonly"
readonly=""
value="15:23"
/>
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time disabled
<div class="a-time-input">
<input
type="time"
id="time-input-3"
name="input time disabled"
disabled=""
value="15:23"
/>
<button
type="button"
class="a-time-input__button"
disabled=""
aria-label="open dialog"
>
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with label
<div class="a-time-input">
<label for="time-input-4">Start time:</label>
<input type="time" id="time-input-4" name="input time with label" />
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with label readonly
<div class="a-time-input">
<label for="time-input-5">Start time:</label>
<input
type="time"
id="time-input-5"
name="input time with label readonly"
readonly=""
value="15:23"
/>
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with label disabled
<div class="a-time-input">
<label for="time-input-6">Start time:</label>
<input
type="time"
id="time-input-6"
name="input time with label disabled"
disabled=""
value="15:23"
/>
<button
type="button"
class="a-time-input__button"
disabled=""
aria-label="open dialog"
>
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with very long label
<div class="a-time-input">
<label for="time-input-7">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
consequatur distinctio provident voluptatum nisi recusandae quod asperiores
quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
</label>
<input type="time" id="time-input-7" name="input time with very long label" />
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with very long label readonly
<div class="a-time-input">
<label for="time-input-8">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
consequatur distinctio provident voluptatum nisi recusandae quod asperiores
quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
</label>
<input
type="time"
id="time-input-8"
name="input time with very long label readonly"
readonly=""
value="15:23"
/>
<button type="button" class="a-time-input__button" aria-label="open dialog">
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
input time with very long label disabled
<div class="a-time-input">
<label for="time-input-9">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae omnis labore
consequatur distinctio provident voluptatum nisi recusandae quod asperiores
quo, architecto cum nesciunt nemo, vel minima possimus et blanditiis
numquam, cupiditate deserunt fugit delectus earum ducimus alias! Quam atque
laborum tempore alias magnam tenetur fuga facere totam, harum, ipsa sit!
</label>
<input
type="time"
id="time-input-9"
name="input time with very long label disabled"
disabled=""
value="15:23"
/>
<button
type="button"
class="a-time-input__button"
disabled=""
aria-label="open dialog"
>
<i class="a-icon boschicon-bosch-ic-calendar-clock"></i>
</button>
</div>
additional content
styles SCSS
.a-time-input {
display: flex;
min-width: 8rem;
@include text-field;
@supports (-moz-appearance:none) {
min-width: 5.5rem;
}
input {
text-transform: uppercase;
&::-webkit-datetime-edit-hour-field:focus,
&::-webkit-datetime-edit-minute-field:focus,
&::-webkit-datetime-edit-ampm-field:focus {
color: var(--neutral__enabled__front__default);
background-color: var(--neutral__focused__fill__default);
mix-blend-mode: multiply;
}
&[readonly],
&:disabled {
+.a-time-input__button {
display: none;
}
}
&::-webkit-calendar-picker-indicator {
display: none;
}
}
@supports (-moz-appearance:none) {
&__button {
display: none;
}
}
}```