# CG-SELECT ## version ~ 0.3.2 ЧИТАТЬ НА РУССКОМ This component allows you to create a custom select. It offers more flexible customization and use of select. Customization, multi-selection and live search by elements are available. ### The ability to customize basic elements, such as: - Select button. - List with select elements. - Placeholder. - In the multiselect mode, customization of chips (selected elements) is available. - Label of the element (if it was specified). - Switch themes from dark to light. - The documentation also lists all the elements for catatomization using CSS. ## Installation #### NPM ``` npm i cg-select ``` #### CDN ``` ``` #### PHP Repository: PHP cg-select package integration ## Usage ### To create a component, you need: 1. Create a regular button element. 2. Give it the cg-dropdown class. ``` ``` 3. Give it a **unique class**, e.g. (cg-dropdown_categories). ``` ``` 4. Create a new instance of the class (new CGSelect) 5. Pass all desired settings as an object #### All options for creating and managing are in the documentation, section "CGSelect class constructor". ### An example of creating a regular select. ```javascript import CGSelect from 'cg-select'; const dropdown = new CGSelect({ selector: '.cg-dropdown_selector', placeholder: 'Выберите авто', items: [ 'BMW', { id: '213sade', title: 'Opel', value: 1, }, 'Mersedes', 'MAN', 'Ferari', ], }); ``` ### An example of initialization a CGSelect in React. ```javascript import { useEffect } from 'react'; import CGSelect from 'cg-select'; const App = () => { useEffect(() => { const drop = new CGSelect({ selector: '.cg-dropdown_selector', placeholder: 'Выберите авто', items: [ 'BMW', { id: '213sade', title: 'Opel', value: 1, }, 'Mersedes', 'MAN', 'Ferari', ], }); }, []); return (