1.1.41 • Published 3 months ago

react-select-custom-component v1.1.41

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

react-select-custom-component

react-select-custom-component is a flexible and customizable React library for building dropdowns and select inputs with custom components, seamless styling, and full accessibility support.

Features

  • 🎨 Customizable Components: Fully replaceable components for rendering options and the dropdown.
  • Fast and Lightweight: Optimized for performance and small bundle size.
  • 📱 Responsive: Works perfectly on mobile and desktop.
  • Accessible: Fully keyboard-navigable and ARIA-compliant.
  • 🚀 TypeScript Support: Built-in TypeScript definitions for better development experience.

Example

Click here to view. here Click here to view. codesandbox

Installation

Install the package using npm or yarn:

 npm install react-select-custom-component
 yarn install react-select-custom-component

Usage

Here is an example of how to use react-select-custom-component in your project:

import { MultipleSelect } from 'react-select-custom-component';

import "react-select-custom-component/dist/tailwind.css"; // import CSS file (important)

// data
const fruits = [
  { id: 1, name: "Apple" },
  { id: 2, name: "Lemon" },
  { id: 3, name: "Watermelon" },
  { id: 4, name: "Melon" },
  { id: 5, name: "Peach" },
  { id: 6, name: "Pomegranate" },
  { id: 7, name: "Banana" },
  { id: 8, name: "Banana" },
  { id: 9, name: "Orange" },
  { id: 10, name: "Pineapple" },
];

function Example() {

  // get value
  const changeSelectedHandler = value => {
    console.log(value);
  }

  return (
      <MultipleSelect
        data={fruits}
        defaultValue={[
            { id: 1, name: "Apple" },
            { id: 2, name: "Lemon" },
        ]}
        isMulti={true}
        title={{
          name: 'Fruits',
          size: '11px',
          color: "#475467"
        }}
        placeholder={{
          name: 'Fruits',
          size: '11px',
          color: "gray"
        }}
        listItemStyle={{
          color: "black",
          size: "11px",
          maxHeight: 150,
          checkboxColor: "#0000ff",
          zIndex: 20
        }}
        isSearch={true}
        lang="en"
        mandatory={false}
        disabled={false}
        style={{ maxWidth: "200px", height: "30px", borderRadius: "3px", color: "#475467", borderColor: "#ccc", outlineColor: "#3b82f6", borderWidth: "2px" }}
        className="react-multiple-select"
        changeSelectedHandler={changeSelectedHandler}
      />
  )
}

export default Example;

Props

PropDescriptionTypeDefault
dataIn this case, complete information is provided in the form of an array, i.e.Array, example { id: 1, name: "Apple" }, {}, {}[]
defaultValueYou need to provide an array as the default value.arrayif isMulti === true { id: 1, name: "Apple" }, {}, {}, else { id: 1, name: "Apple" }
isMultiIf true, there are 2 or more choices, otherwise there is only 1 choicebooleantrue
titleFor the title aboveobject{ name: "", size: "11px", color: "gray" }
placeholderFor placeholderobject{ name: "placeholder", size: "11px", color: "gray" }
listItemStyleStyling listsobject{ color: "black", size: "11px", maxHeight: 150, checkboxColor: "#0000ff" }
isSearchIf True, the ability to search in lists will appear.booleantrue
langChange the language of the placeholder in the search field.string"en"
mandatoryThis is to indicate that select is mandatory.booleanfalse
styleTo give optional styles.object{ maxWidth: "200px", height: "30px", borderRadius: "5px", color: "#0073FB" }
classNameYou can change the position of the text yourself using CSS.stringreact-multiple-select
changeSelectedHandlerYou can get the result using this functionfunctionoptional function

Why Use react-select-custom-component?

  1. Ease of Use: Simple API and easy integration.
  2. Full Control: Customize every part of the dropdown to suit your application.
  3. Community Driven: Built with best practices for React and modern web development.
  4. Rich Documentation: Comprehensive examples and guides for every use case.

Keywords

React Select, Custom Dropdown, React Dropdown, Select Component, Customizable Select, React Library, Accessible Dropdown, multiple-select, select, react-select, react-select-multiple, multi-select-react, tailwindcss-select, select-components, react-select-component, select-multiple, react-select-custom-component, react-custom-component, react-select-custom, custom-select, dropdown, dropdown-select-component,

Development

To contribute or make changes, clone the repository and install dependencies:

git clone https://github.com/hikmatjan1/react-select-custom-component.git
cd react-select-custom-component
npm install

Run the development server:

npm run dev

Updates

  1. A full update has been implemented starting with version 1.0.28. I apologize to everyone for the inconvenience caused by the missing CSS file.
  2. Starting from version 1.1.36, the option to select only 1 has also been added. Returns an object as the result, otherwise returns an array.

License

React Select Custom Component is open-source and available under the MIT License.

1.1.41

3 months ago

1.1.40

3 months ago

1.1.39

3 months ago

1.1.38

3 months ago

1.1.37

5 months ago

1.1.36

5 months ago

1.0.36

5 months ago

1.0.35

5 months ago

1.0.34

5 months ago

1.0.33

5 months ago

1.0.32

5 months ago

1.0.31

5 months ago

1.0.30

5 months ago

1.0.29

5 months ago

1.0.28

5 months ago

1.0.27

5 months ago

1.0.26

5 months ago

1.0.25

5 months ago

1.0.24

5 months ago

1.0.23

5 months ago

1.0.22

5 months ago

1.0.21

5 months ago

1.0.20

5 months ago

1.0.19

5 months ago

1.0.18

5 months ago

1.0.17

5 months ago

1.0.16

5 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago