logo dile-components dile-components

dile-time-picker

Web Component to select a complete time (hours, minutes, seconds) using numeric pickers. Designed to integrate easily in forms, it is a form-associated element compatible with FormData and provides validation and customizable error messages.

Installation

npm i @dile/ui

Usage

Import the component.

import '@dile/ui/components/time-picker/time-picker.js';

Use the component.

<dile-time-picker label="Select time"></dile-time-picker>

Properties

Methods

Events

CSS Custom Properties

You can customize the component's appearance using the following CSS properties inherited from messageStyles and number-picker-element:

Custom property Description Default
--dile-input-label-margin-bottom Bottom margin of the label 4px
--dile-input-label-font-size Label font size 1em
--dile-input-label-color Label color #59e
--dile-input-label-font-weight Label font weight normal
--dile-input-message-padding-top Space from input to message 4px
--dile-input-message-font-size Message font size 0.875rem
--dile-input-message-color Message text color #888
--dile-input-message-error-color Message text color on errored state #c00

Note: To customize the internal dile-number-picker-element styles, refer to the dile-number-picker-element documentation.

Demos

Simple Time Picker

<script type="module">
  import '@dile/ui/components/time-picker/time-picker.js';
</script>
<dile-time-picker label="Time"></dile-time-picker>

Time Picker with initial value and error message

<dile-time-picker 
  label="Finish time"
  value="03:30:00"
  errored
  message="This is a message"
></dile-time-picker>