uc-input-field-date

1.0.0 • Public • Published

Unchained UI

Input Date Field UI Component

NPM Version NPM Downloads

Usage

import InputDate from 'uc-input-field-date';
 
const elDisplay = get('#display');
 
const input = new InputDate({
  title: 'date field',
  onChange: val => {
    console.log('new date', val);
  }
}).appendTo(elDisplay);
 

This component follows Unchained UI guidelines.

Constructor options:

  • el – HTLMElement, parse all the information from the DOM element
  • title — string, title of the input
  • value — integer, timestamp in milliseconds or string, representing a date in a format recognized by the Date.parse() method
  • locale — a locale object. Defined as in uc-calendar
  • debounce – number, default 500ms. Debounce onChange calls
  • onChange — function, callback will be called when value is changed

Methods

value([val])

if val is undefined returns current value, otherwise sets the value. The value is an instance of the Date class.

focus()

Sets the focus.

blur()

Removes focus.

active(state)

Sets the state.

error([msg])

Shows the error with optional msg.

remove()

Removes the input.

License MIT

© velocityzen

Dependents (0)

Package Sidebar

Install

npm i uc-input-field-date

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

54.1 kB

Total Files

14

Last publish

Collaborators

  • velocityzen