ui-inline-input v1.1.0
ui-inline-input
Inline text/dropdown input web UI component
Installation
$ npm install ui-inline-input --save-devUsage
const Inlineinput = require('ui-textinput');
const options = {
// Set up options here (see below)
};
const firstNameField = new Inlineinput(options);
someContainerElement.appendChild(firstNameField.element);
firstNameField.focus();Options
Type: {Object}
type
Type: {String}
Optional. Default: text.
Reflects the type attribute of <input> element.
As of now, there is only support for text.
labelText
Type: {String}
Label text shown in UI.
labelWidth
Type: {String}
Optional. Default: 50%.
Sets the width of the label.
onValueChanged
Type: {Function | Array<Function>}
Optional.
Callback function(s) that will be called every time the value of the element changes.
Provided arguments: fn(value)
{String} value- New value of the element
API
Properties
element
Type: {HTMLElement}
Returns reference to the DOM node created by the constructor.
Methods
focus()
Sets input focus on the element.
Return: {undefined}
setValue(val)
Sets the element's value.
Parameters:
{String} val- New value
Return: {undefined}
getValue()
Gets the current value of the element.
Return: {String}
enable()
Enables the input field.
Return: {undefined}
disable()
Disables the input field.
Return: {undefined}