Skip to content

muan/input-duration-element

Repository files navigation

<input-duration>

A Custom Element for <input type="duration">.

References:

Usage

<!-- Include `InputDurationElement` -->
<script src="https://unpkg.com/[email protected]" type="module"></script>

<!-- Render `<input-duration>` -->
<label for="duration">Duration</label>
<input-duration id="duration" name="duration"></input-duration>

Attributes

  • max (number): Max value of duration in seconds.
  • name (string): Input name.
  • value (number): Default value of duration in seconds.

Shadow Parts

  • ::part(divider): Divider (:).

Slots

  • hour: Default to :.
  • minute: Default to :.
  • second: Default to empty.

Methods

  • inputDuration.value = number sets duration value to number in seconds.
  • inputDuration.value gets duration value to number in seconds.

Events

  • change fires when duration value changes.

Todo

  • Support min
  • Validation
  • Figure out maxLength, max, size.