diff --git a/.eslintrc b/.eslintrc index 91a9bdce67..484fc5a615 100644 --- a/.eslintrc +++ b/.eslintrc @@ -17,7 +17,7 @@ "quotes": [2, "single", "avoid-escape"], "react/jsx-boolean-value": 1, "react/jsx-no-undef": 1, - "react/jsx-quotes": 1, + "jsx-quotes": 1, "react/jsx-sort-prop-types": 1, "react/jsx-uses-react": 1, "react/jsx-uses-vars": 1, diff --git a/README.md b/README.md index 27f19880ef..ef6d27e65e 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,32 @@ var getOptions = function(input, callback) { /> ``` +### Categorized Select + +You can utilize categorized selections by setting `categoized={true}`. In this mode: + +* You must pass in an object of arrays containing the options +* The keys of the object become to categories + +```js +var Select = require('react-select'); + +var options = { + "Primary": [ + { value: "blue", label: "Blue" }, + { value: "green", label: "Green" }, + { value: "red", label: "Red" } + ], + "Secondary": [ + { value: "yellow", label: "Yellow" }, + { value: "magenta", label: "Magenta" }, + { value: "cyan", label: "Cyan" } + ] +}; + + tag - noResultsText | string | placeholder displayed when there are no matching search results - onBlur | func | onBlur handler: function(event) {} - onChange | func | onChange handler: function(newValue) {} - onFocus | func | onFocus handler: function(event) {} - optionRenderer | func | function which returns a custom way to render the options in the menu - options | array | array of options - placeholder | string | field placeholder, displayed when there's no value - searchable | bool | whether to enable searching feature or not - searchPromptText | string | label to prompt for search input - value | any | initial field value - valueRenderer | func | function which returns a custom way to render the value selected + Property | Type | Description +:-----------------------|:------------------|:-------------------------------- + addLabelText | string | text to display when allowCreate is true + allowCreate | bool | allow new options to be created in multi mode (displays an "Add \