1.1.1 • Published 7 months ago

react-select-comp-senga v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

react-select-senga

A React library for creating custom Select components.

prerequisites

  • react
  • react-dom
  • npm

installation

install with npm:

npm install react-select-senga

install with yarn:

yarn add react-select-senga

customization

You have the ability to customize the behavior and appearance of the Select component. Here's how you can do it:

using options

You can pass an array of options to the options prop to define the possible choices in the dropdown menu. Each option should have a value and a label. Here's an example:

import React from 'react';
//import the Select component 
import Select from 'react-select-senga';

function MySelect(){
   const optionList = [
      {value: 'option1', label: 'Option 1'},
      {value: 'option2', label: 'Option 2'},
      {value: 'option3', label: 'Option 3'},
   ];

  const [selectedOption, setSelectedOption] = React.useState(null);

    return (
        <Select
        options={optionList}
        value={selectedOption}
        onChange={setSelectedOption}
        />
    );
}

export default MySelect;

using children

You can also pass options as children to the Select component. Each option should have a value and a label. Here's an example:

import React from 'react';
import Select from 'react-select-senga';

function MySelect(){
  const [selectedOption, setSelectedOption] = React.useState(null);

    return (
        <Select
        value={selectedOption}
        onChange={setSelectedOption}
        >
          <option value="option1">Option 1</option>
          <option value="option2">Option 2</option>
          <option value="option3">Option 3</option>
        </Select>
    );
}

export default MySelect;
1.1.1

7 months ago

1.1.0

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago