import Input from 'uc-input';
const elDisplay = get('#display');
const input = new Input({
title: 'test field',
slugify: true,
trim: true,
onChange: val => {
console.log('val', 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 — string, initial value
- type – string, default text. HTML input type
- limit — number, the text limit
- debounce – number, default 500ms. Debounce onChange calls
- onChange — function, callback will be called when value is changed
- slugify — boolean, slugify input
- trim — boolean, trim input
if val
is undefined returns current value, otherwise sets the value.
Sets the focus.
Removes focus.
Sets the state.
Shows the error with optional msg
.
Removes the input.
Adds the transform function to the end of transformation chain.
Adds the transform function to the begining of transformation chain.
This package also provides the field
and pop
mixins. It makes easy to create custom input fields. Check the uc-input-field-date implementation for details.
License MIT
© velocityzen