1.1.0 • Published 8 years ago

ui-inline-input v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

ui-inline-input

Inline text/dropdown input web UI component

js-semistandard-style

Installation

$ npm install ui-inline-input --save-dev

Usage

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}