1.4.0 • Published 10 months ago
dropdowndelamort v1.4.0
dropdowndelamort est un composant dropdown pour React permettant de créer facilement des menus déroulants stylisés avec une grande flexibilité.
Pour utiliser dropdowndelamort, assurez-vous d'avoir les éléments suivants installés :
- react: 18.3.1
- react-dom: 18.3.1
npm install dropdowndelamort
import Dropdown from 'dropdowndelamort';
import 'dropdowndelamort/dist/style.css'
import { useState } from 'react';
function MyComponent() {
const STATES = [
{ value: 'CA', label: 'California' },
{ value: 'NY', label: 'New York' },
{ value: 'TX', label: 'Texas' },
];
const STATE_DEFAULT_TEXT = 'Select a state';
const fields = [
{
type: 'dropdown',
id: 'state',
name: 'state',
label: 'State',
options: STATES,
defaultText: STATE_DEFAULT_TEXT,
},
];
const [selectedValue, setSelectedValue] = useState('');
const handleChange = (e) => {
setSelectedValue(e.target.value);
};
return (
<div>
{fields.map(field => {
if (field.type === 'dropdown') {
return (
<Dropdown
key={field.id}
id={field.id}
selection={field.options}
defaultText={field.defaultText}
value={selectedValue}
onChange={handleChange}
/>
);
}
return null;
})}
</div>
);
}
export default MyComponent;
1.2.0
10 months ago
1.1.0
10 months ago
1.0.0
10 months ago
1.4.0
10 months ago
1.3.0
10 months ago
0.3.0
11 months ago
0.2.1
11 months ago
0.8.0
10 months ago
0.5.5
10 months ago
0.5.0
11 months ago
0.4.1
11 months ago
0.2.3
11 months ago
0.4.0
11 months ago
0.3.1
11 months ago
0.2.2
11 months ago
0.7.0
10 months ago
0.6.0
10 months ago
0.5.1
11 months ago
0.2.0
1 year ago
0.1.0
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.0
1 year ago