1.0.14 • Published 3 years ago

custom-input-npm v1.0.14

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

What is this?

Create input with cross button by id.

Installation

npm i custom-input-npm

Usage

import { inputWithCross } from 'custom-input-npm';

  inputWithCross({
     id: 'input',
     inputStyles: {
       backgroundColor: 'red'
     },
     parentId: 'root',
     onClick: () => {},
     onFocus: () => {},
     onBlur: () => {},
     onChange: () => {},
     onEnter: () => {},
     withDropdown: true,
     dropDownProps: {
       options: ['yes', 'no', 'hmm'],
       styles: {},
     },
  });

To change cross button style pass in props crossStyle obj.

import { inputWithCross } from 'custom-input-npm';

  inputWithCross({
     id: 'input',
     crossStyle: {
       lineStyle: '1px solid red',
       height: '12px',
       positionRight: '10px',
       positionTop: '20%',
     },
     parentId: 'root',
  });

To add dropdown to input add prop withDropdown and dropDownProps there must be options an array if it empty dropdown will not shown.

import { inputWithCross } from 'custom-input-npm';

  inputWithCross({
     id: 'input',
     parentId: 'root',
     withDropdown: true,
     dropDownProps: {
       options: ['yes', 'no', 'hmm'],
       styles: {},
     },
  });

Options

  • id - string (without #),
  • parentId - string (without #),
  • inputStyles- object with styles for input,
  • crossStyle- object with styles for cross button, crossStyle properties: lineStyle, height, positionRight, positionTop, all should be strings.
  • onClick - function,
  • onFocus - function,
  • onBlur - function,
  • onChange - function,
  • onEnter - function,
  • withDropdown- boolean to show dropdown,
  • dropDownProps- object with options and styles for dropdown, dropDownProps properties: options an array, styles an object.
1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago