@marjak93/dropdown-ui

1.2.0 • Public • Published

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

/@marjak93/dropdown-ui/

    Package Sidebar

    Install

    npm i @marjak93/dropdown-ui

    Weekly Downloads

    0

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    40.4 kB

    Total Files

    16

    Last publish

    Collaborators

    • marjak93