1.2.14 • Published 2 years ago

react-select-several v1.2.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-select-several

⚡️ Features

  • 100% responsive
  • 100% customizable
  • Supports any css unit
  • No third party dependency
  • TypeScript ready
  • Multi select option
  • Multi input option

Installation

$ npm i react-select-several

Examples

codesandbox

Basic Usage

For select field

//Import react-select-several component
import { SelectMultiple } from 'react-select-several'

export const App = () => {
  const onChange = (values: string[]) => {
    console.log(values)
  }

  return (
    <>
      <SelectMultiple onChange={onChange}>
        <option>HTML</option>
        <option>CSS</option>
        <option>JavaScript</option>
      </SelectMultiple>
    </>
  )
}

For input field

//Import react-select-several component
import { InputMultiple } from 'react-select-several'

export const App = () => {
  const onChange = (values: string[]) => {
    console.log(values)
  }

  return (
    <>
      <InputMultiple onChange={onChange} />
    </>
  )
}

Props

React-select-several has two main components, a select field and input field. It is majorly used to select or input multiple options. Here is a table of the available props that can be passed down.

General props

PropsDescriptionTypeDefault
nameSet the name of the input or select fieldstring
idSet the name of the input or select fieldstring
onChangeFunction to get the values(e: string[]) => void
maxNumberSets the maximum number for input or selectionnumber
tagIconCustom Icon for the tag deletion, (react-icons can be used)React.ReactElement
placeholderSets the placeholder for the input or select fieldstring
requiredProps to ensure the field is requiredbooleanfalse
disableProps for disabling the fieldbooleanfalse
autoFocusProps that lets you specify if the field should have focus when the page loadsbooleanfalse
autoCompleteProps providing a hint for a user agent's autocomplete featurestring
tagContainerClassCustom classname for the parent container of all tagsstring
tagBackgroundColorCustom background color for tagsstring
tagTextColorCustom color for tag textstring

Select props

PropsDescriptionType
childrenA list of options for the select field
selectTagClassCustom class for tagsstring
selectTagTextClassCustom class for tags textsstring
selectTagIconClassCustom class for tags iconsstring
selectClassCustom class for select fieldstring

Input props

PropsDescriptionType
inputTagClassCustom class for tagsstring
inputTagTextClassCustom class for tags textsstring
inputTagIconClassCustom class for tags iconsstring
inputClassCustom class for input fieldstring

Contribution

React-select-several is an open-source project and contributions are welcome. Got ideas on how to make this better? Open an issue!

⚖️ Licence

MIT (c) Sonia Uduma.

1.2.14

2 years ago

1.2.13

2 years ago

1.2.12

2 years ago

1.2.11

2 years ago

1.2.10

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

0.0.1

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago