@rockethell/selectmenu
v1.0.1
Published
A select menu with react and tailwind
Downloads
7
Maintainers
Readme
react select menu component
Installation
npm i @rockethell/selectmenu
Props needed
label
: label text displayed above the select menudata
: array of objects to be displayed in the select menulabelKey
: key to be displayed as label in the select menuvalueKey
: key to be used as value in the select menuvalue
: value of the selected optionrest
: additional props to be passed to the select menu
Example
import SelectMenu from '@rockethell/selectmenu';
function App() {
const departments = [
{
department: 'Sales',
},
{
department: 'Marketing',
},
];
const states = [
{
name: 'Alabama',
abbreviation: 'AL',
},
{
name: 'Alaska',
abbreviation: 'AK',
},
];
return (
<div className='flex h-screen items-center justify-center gap-5'>
<h1 className='text-2xl font-bold text-white'>Select Menu</h1>
<SelectMenu
label='Departments'
data={departments}
valueKey='department'
labelKey='department'
/>
<SelectMenu
label='States'
data={states}
valueKey='abbreviation'
labelKey='name'
/>
</div>
);
}
export default App;