1.0.10 • Published 8 months ago

react-multis v1.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

react-multis

A lightweight, customizable multi-select component for web applications. Easy to integrate, responsive,Dark mood, and supports user interactions with customizable responses.

🎉🎉 Features

  • Simple setup and usage.
  • Customizable styles and behavior.
  • Built-in support for user interactions and responses.
  • Lightweight with minimal dependencies.
  • Easily customizable via props.
  • Typescript support
  • Small bundle size

Example

Example

1. Installation

npm install react-multis

yarn add react-multis

pnpm add react-multis

2. Live Demo

React-multi

3. Simple usage

import React, { useState } from "react";
import { MultiSelect, Options } from "react-multis";

const App = () => {
  const options = [
    { value: "chocolate", label: "Chocolate" },
    { value: "strawberry", label: "Strawberry" },
    { value: "vanilla", label: "Vanilla" },
    { value: "strawberryss", label: "Strawberry" },
  ];
  const handleSelect = (selectedValue: Options[]) => {
    console.log(selectedValue);
  };

  return <MultiSelect options={options} onChange={handleSelect} />;
};

export default App;

3.1 With Props usage

import React, { useState } from "react";
import { MultiSelect, Options } from "react-multis";

const App = () => {
   const options = [
    { value: "chocolate", label: "Chocolate" },
    { value: "strawberry", label: "Strawberry" },
    { value: "vanilla", label: "Vanilla" },
    { value: "strawberryss", label: "Strawberry" },
  ];
   const handleSelect = (selectedValue: Options[]) => {
    console.log(selectedValue);
  };

  return (
    <MultiSelect
      isSearchable
      options={options}
      onChange={handleSelect}
      creatable
      placeholderText="Select an item"
      size="sm"
      maxLengthShow={2}
      width={400}
      maxHeight={300}
  );
};

export default App;

Read Documentation

React-multi

Props

PropTypeDefaultDescription
optionsOptions[][]Array of options for the dropdown.
onChange(Options[]) => voidundefinedCallback function triggered on option change.
isSearchablebooleantrueEnables or disables the search functionality.
placeholderTextstring""Text displayed when no options are selected.
chipbooleantrueDisplays selected options as removable chips.
checkedbooleantruePre-checks options when set to true.
disabledbooleanfalseDisables the dropdown when set to true.
defaultValueOptions[][]Array of pre-selected options.
creatablebooleanfalseAllows creation of new options dynamically.
emptyStatebooleanfalseDisplays a message when no options are available.
size"sm","md","lg""md"Adjusts the size of the dropdown (small, medium, large).
widthnumber400Sets the custom width of the dropdown.
maxHeightnumber300Maximum height for the dropdown menu.
maxLengthShownumber10Maximum number of visible options before scrolling is enabled.

This documentation helps developers understand the props they can use, along with their types and defaults, including how to apply custom styles through customClass.

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago