1.2.0 • Published 4 years ago

@marjak93/dropdown-ui v1.2.0

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

Dropdown UI

Dropdown UI is a simple React component library that implements one component - Dropdown.

Installation

Add the library to your project by running one of the following commands:

npm install @marjak93/dropdown-ui

or

yarn add @marjak93/dropdown-ui

Usage

Dropdown has two parts - Select and Option. The syntax is inspired by the classic <select> and <option> tags in HTML.

import { Dropdown } from "@marjak93/dropdown-ui";

const MyDropdown = () => {
  const [myValue, setMyValue] = React.useState(null);

  const handleChange = (value) => {
    setMyValue(value);
  };

  return (
    <Dropdown.Select label="Age" value={myValue} onChange={handleChange}>
      <Dropdown.Option value="10">10</Dropdown.Option>
      <Dropdown.Option value="20">20</Dropdown.Option>
      <Dropdown.Option value="30">30</Dropdown.Option>
    </Dropdown.Select>
  );
};

License

MIT

1.2.0

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago