Package Exports
- react-jsx-select
- react-jsx-select/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-jsx-select) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-jsx-select
A simple and lightweight dropdown element with JSX options for form.
Installation
for yarn
yarn add react-jsx-select
for npm
npm install react-jsx-select
Basic Example Code
import { Select } from 'react-jsx-select';
<Select
options={[
{ value: 1, label: 1, jsx: <span>1</span> },
{ value: 2, label: 2, jsx: <span>2</span> },
{ value: 3, label: 3, jsx: <span>3</span> },
{ value: 4, label: 4, jsx: <span>4</span> },
{ value: 5, label: 5, jsx: <span>5</span> },
]}
onChange={(value) => console.log(value)}
/>;
Example with All Props
import { Select } from 'react-jsx-select';
<Select
options={[
{ value: 1, label: 1, jsx: <span>1</span> },
{ value: 2, label: 2, jsx: <span>2</span> },
{ value: 3, label: 3, jsx: <span>3</span> },
{ value: 4, label: 4, jsx: <span>4</span> },
{ value: 5, label: 5, jsx: <span>5</span> },
]}
onChange={(e) => console.log(e)}
name='sample'
placeholder='Select Please...'
defaultValue={2}
disabled={true}
required={false}
className='form-control'
listStyle={{
backgroundColor: '#fafafa',
border: '1px solid #ccc',
}}
activeItemStyle={{ backgroundColor: '#e0e000' }}
iconWidth='50'
iconStyle={{
fontSize: '26px',
borderRadius: '0 5px 5px 0',
}}
purpose='search'
onSearch={(e) => console.log(e)}
onExactSearch={(e) => console.log(e)}
/>;