Skip to content

Time input - Web Component

...

Attention!

The localization format of the input comes from the format settings of the client's operation system.

Browser support

Parameters

The Web component uses a <z-time-input> tag.

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescription
configstring

The main parameter has two components following the pattern: <shape><?:size>.

  • shape: Establishes the styling of the input. Default value is line . Possible values are: shaped or line. ,
  • size: (optional) defines de size of the input. The default value is m, being omitted from the param. The possible values are: m or l.
labelstringLabel of the input
readonly
(optional)
booleanTransforms the input into an output
value
(optional)
stringValue of the model
disabled
(optional)
booleanBlocks the interaction with the input component.
required
(optional)
booleanMarks the input component as required.
name
(optional)
stringIdentification for the field inside the form
invalid
(optional)
booleanThe forced state for set the input as invalid
help-text
(optional)
stringThe forced message to be shown under the input

The events emitted from the component are:

NamePayloadDescription
onchangestringReturns the new value of the "value" attribute

Playground

Customization

HTML Examples

Imports
html
<link rel="stylesheet" href="/0.3.7/@zurich/web-components/styles.css" />
<script type="module" src="/0.3.7/@zurich/web-components/time-input.js"></script>
Code
html
<!-- Default -->
<z-time-input label="Time input"></z-time-input>
<z-time-input label="Time input" config="shaped"></z-time-input>

<!-- With value -->
<z-time-input label="Time input" value="04:20"></z-time-input>
<z-time-input label="Time input" value="04:20" config="shaped"></z-time-input>

<!-- Disabled -->
<z-time-input label="Time input" disabled></z-time-input>
<z-time-input label="Time input" disabled config="shaped"></z-time-input>

<!-- Readonly -->
<z-time-input label="Time input" readonly value="04:20"></z-time-input>
<z-time-input label="Time input" readonly value="04:20" config="shaped"></z-time-input>

<!-- With help text -->
<z-time-input label="Time input" help-text="Help text"></z-time-input>
<z-time-input label="Time input" help-text="Help text" config="shaped"></z-time-input>

<!-- Invalid -->
<z-time-input label="Time input" help-text="Invalid input" invalid></z-time-input>
<z-time-input label="Time input" help-text="Invalid input" invalid config="shaped"></z-time-input>