1.8.15 • Published 2 years ago

react-bootstrap-custom-inputs v1.8.15

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

React Bootstrap Custom Inputs

A library providing great looking input elements for projects using React with Bootstrap.

Interactive sandbox(Storybook) to test out the components

react-bci.vercel.app

Usage examples:

With Hooks

import { useState } from 'react';
import DatePicker from 'react-bootstrap-custom-inputs';

function App() {
  const [date, setDate] = useState('2021-01-31');

  const handleDate = useCallback(({ target: { value } }) => setDate(value), []);

  return (
    <div className="container-fluid vh-100">
      <div className="row h-75 justify-content-center align-items-center">
        <DatePicker
          onChange={handleDate}
          value={date}
          label="Date"
          required
          className="col-4"
        />
      </div>
    </div>
  );
}

export default App;

With Classes

import React, { Component } from 'react';
import { DatePicker } from 'react-bootstrap-custom-inputs';

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      date: '2021-01-31',
    };

    this.handleChange = this.handleChange.bind(this);
  }

  handleChange(e) {
    const { name, value } = e.target;

    this.setState({
      [name]: value,
    });
  }

  render() {
    const { date } = this.state;

    return (
      <div className="container-fluid vh-100">
        <div className="row h-75 justify-content-center align-items-center">
          <DatePicker
            onChange={this.handleChange}
            value={date}
            name="date"
            label="Date"
            required
            className="col-4"
          />
        </div>
      </div>
    );
  }
}

export default App;

Autocomplete Props:

NameRequiredDescriptionDefault
onChangetruehandler function-
nametruestring representing State property-
listtruearray of objects with key(unique string), value(string), title(optional string), isImportant(optional boolean) to display a star icon, isBackground(optional boolean) to hide on open, children(support for nested list of the same format) properties-
labelfalsestring to enable interaction with the input through it's label-
valuefalsestring or string[] matching key property of list objects-
classNamefalsestring consisting of classes to apply to the input-
languagefalsestring currently supported values en, lv'en'
debouncefalsenumber representing debounce in milliseconds500ms
autoCompletefalse'on' or 'off''off'
multiselectfalsebool to enable the ability of selecting multiple itemsfalse
multiselectPreviewfalsenumber to display values if selected count is equal or less, 'default' to display 'Selected #', 'value' to always display value'default'
validfalsebool to override default required with your own definition (i.e. valid === true when at least 3 items are selected)-
requiredfalsebool to enable Bootstrap is-valid/is-invalid validationsfalse
disableDeselectfalsebool === true disables ability to deselect when multiselect === falsefalse
disabledfalseboolfalse

DatePicker Props:

NameRequiredDescriptionDefault
onChangetruehandler function-
nametruestring representing State property-
labelfalsestring to enable interaction with the input through it's label-
valuefalsestring or string[] in RFC2822 or ISO format'DD.MM.YYYY'
classNamefalsestring consisting of classes to apply to the input-
languagefalsestring currently supported values en, lv'en'
highlightDatefalsestring in RFC2822 or ISO format''
highlightColorfalsestring describing color in hexadecimal''
asIconfalsebool to render an icon depicting a calendar instead of text inputfalse
alignmentfalsestring controlling expanded calendar alignment left, right'left'
multiselectfalseboolfalse
validfalsebool-
requiredfalseboolfalse
disabledfalseboolfalse
disableDeselectfalsebool === true disables ability to deselect when multiselect === falsefalse

TimePicker Props:

NameRequiredDescriptionDefault
onChangetruehandler function-
nametruestring representing State property-
labelfalsestring to enable interaction with the input through it's label-
valuefalsestring in the format HH:mm'--:--'
classNamefalsestring-
validfalsebool-
requiredfalseboolfalse
disabledfalseboolfalse
disableDeselectfalsebool === true disables ability to deselect when multiselect === falsefalse

TextInput Props:

NameRequiredDescriptionDefault
onChangetruehandler function-
nametruestring representing State property-
labelfalsestring to enable interaction with the input through it's label-
valuefalsestring''
debouncefalsenumber representing debounce in milliseconds500ms
classNamefalsestring-
validfalsebool-
requiredfalseboolfalse
disabledfalseboolfalse
1.8.15

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.6.3

2 years ago

1.8.0

2 years ago

1.6.2

2 years ago

1.6.0

2 years ago

1.7.7

2 years ago

1.6.11

2 years ago

1.7.6

2 years ago

1.6.10

2 years ago

1.7.5

2 years ago

1.6.13

2 years ago

1.7.4

2 years ago

1.6.12

2 years ago

1.6.15

2 years ago

1.6.14

2 years ago

1.6.17

2 years ago

1.6.16

2 years ago

1.6.19

2 years ago

1.6.18

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.20

2 years ago

1.6.22

2 years ago

1.6.21

2 years ago

1.5.12

2 years ago

1.8.9

2 years ago

1.8.10

2 years ago

1.8.8

2 years ago

1.8.11

2 years ago

1.8.7

2 years ago

1.6.9

2 years ago

1.8.12

2 years ago

1.8.6

2 years ago

1.6.8

2 years ago

1.8.13

2 years ago

1.8.5

2 years ago

1.6.7

2 years ago

1.8.14

2 years ago

1.8.4

2 years ago

1.6.6

2 years ago

1.4.11

2 years ago

1.8.3

2 years ago

1.4.10

2 years ago

1.4.12

2 years ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.3.5

2 years ago

1.4.3

2 years ago

1.3.4

2 years ago

1.4.2

2 years ago

1.3.3

2 years ago

1.4.1

2 years ago

1.3.2

2 years ago

1.4.0

2 years ago

1.4.9

2 years ago

1.4.8

2 years ago

1.4.7

2 years ago

1.2.0

2 years ago

1.3.1

2 years ago

1.2.1

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago