2.7.0 • Published 4 years ago

cpr-select v2.7.0

Weekly downloads
132
License
MIT
Repository
github
Last release
4 years ago

cpr-select Build Status

Canopy React Select

Requirements

  • React ^0.14.2
  • Lodash methods findIndex

Installation

  1. Install through npm install --save cpr-select
  2. Load the required stylesheet src/select.css
  3. Optional - if you want some default styling use the stylesheet: build/external-styles.css

Usage

Props

  • selected: the key of the currently selected item
  • options: the items to select from. You can insert a separator between items by putting {separator: true} as an item. You can also prevent the user from selecting an item by including disabled: true in your item object.
  • onChange: called when selected item changes
  • onBlur: called when the select widget is blurred (with the currently selected item)
  • disabled: pass true to disable the input
  • placeholder: placeholder for input
  • selectClass: (optional) custom class to be added to the select element
  • outerClass: (optional) custom class to be added to the outer containing element
  • inputClass: (optional) custom class to be added to the hidden input element
  • dropdownClass: (optional) custom class to be added to the dropdown element
  • zIndex: (optional) override the default z-index of 1000

Basic

import CanopySelect from 'cpr-select';
import 'cpr-select/src/select.css';

let items = [
  {
    "value": "Alabama",
    "key": "AL"
  }, {
    "separator": true,
  }, {
    "value": "Alaska",
    "key": "AK"
  }, {
    "value": "American Samoa",
    "key": "AS",
    "disabled": true
  }
];

function itemsChanged(key, item, index) {
  console.log(key);
}

<CanopySelect options={items} onChange={itemsChanged} placeholder="Select a country" selected="AK"></CanopySelect>

Demo

http://canopytax.github.io/cpr-select/

2.7.0

4 years ago

2.6.1

5 years ago

2.6.0

5 years ago

2.5.6

5 years ago

2.5.5

6 years ago

2.5.3

6 years ago

2.5.4

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

2.0.0-alpha.1

7 years ago

1.4.3

7 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.1

8 years ago

1.1.0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago