@cyril-vtn/select
v1.0.8
Published
A customizable and easy-to-use select component for React
Downloads
8
Readme
Installation
npm install @cyril-vtn/select
Usage
import Select from "@cyril-vtn/select";
const options = [
{ value: "option1", label: "Option 1" },
{ value: "option2", label: "Option 2" },
{ value: "option3", label: "Option 3" },
];
const App = () => {
const [selectedOption, setSelectedOption] = useState(null);
return (
<div>
<Select
label="Select an option"
options={options}
value={selectedOption}
onChange={(e) => setSelectedOption(e.target.value)}
/>
</div>
);
};
export default App;
Props
| Prop | Type | Default | Description |
| ---------- | -------- | ---------- | ------------------------------------------------------ |
| label
| string | Select
| The label of the select component. |
| options
| array | []
| The options to display in the select component. |
| value
| string | null
| The value of the selected option. |
| onChange
| function | () => {}
| The function to call when the selected option changes. |
| name
| string | null
| The name of the select component. |
License
This project is licensed under the MIT License.
Author
Cyril Votion