1.0.0 • Published 3 years ago
gpollet-dropdown v1.0.0
GPollet Dropdown
A React component using Typescript to create a dropdown menu from a list of items.
Installation
To install the latest version using npm :
npm install gpollet-dropdownTo install the latest version using Yarn :
yarn add gpollet-dropdownUsage/Examples
Component can be used as a regular React component once imported into a file.
Props
All props are typed using Typescript.
| Prop Name | Role | Type | Required |
|---|---|---|---|
| data | Values to display as < option/>{string}</ option> in the dropdown menu | {name: string}[] | x |
| label | Text content of the tag. | string | x |
| id | Id that will be assigned to the tag. | string | x |
| name | Name that will be assigned to the tag. Default value : {id} | string | |
| width | Width of the element. Default value : 300 | number | |
| height | Height of the element. Default value : 300 | number |
import Dropdown from "gpollet-dropdown";
function App() {
return (
<>
<div className="App">
<Dropdown
data={[
{ name: "Option A" },
{ name: "Option B" },
{ name: "Option C" },
]}
label="Dropdown Example"
id="dropdown-id"
/>
</div>
</>
);
}
export default App;1.0.0
3 years ago