diff --git a/README.md b/README.md
index 41068257..80031daa 100644
--- a/README.md
+++ b/README.md
@@ -41,12 +41,14 @@ A lightweight and fast control to render a select component that can display hie
- [Usage](#usage)
- [Props](#props)
- [className](#classname)
+ - [searchTerm](#searchterm)
- [clearSearchOnChange](#clearsearchonchange)
- [onChange](#onchange)
- [onNodeToggle](#onnodetoggle)
- [onAction](#onaction)
- [onFocus](#onfocus)
- [onBlur](#onblur)
+ - [onSearchChange](#onsearchchange)
- [data](#data)
- [texts](#texts)
- [keepTreeOnSearch](#keeptreeonsearch)
@@ -57,6 +59,7 @@ A lightweight and fast control to render a select component that can display hie
- [hierarchical](#hierarchical)
- [simpleSelect](#simpleselect)
- [radioSelect](#radioselect)
+ - [pageSize](#pagesize)
- [showPartiallySelected](#showpartiallyselected)
- [showDropdown](#showdropdown)
- [initial](#initial)
@@ -66,7 +69,8 @@ A lightweight and fast control to render a select component that can display hie
- [searchPredicate](#searchpredicate)
- [inlineSearchInput](#inlinesearchinput)
- [tabIndex](#tabIndex)
- - [disablePoppingOnBackspace](#disablePoppingOnBackspace)
+ - [disablePoppingOnBackspace](#disablepoppingonbackspace)
+ - [disableKeyboardNavigation](#disablekeyboardnavigation)
- [Styling and Customization](#styling-and-customization)
- [Using default styles](#default-styles)
- [Customizing with Bootstrap, Material Design styles](#customizing-styles)
@@ -188,6 +192,12 @@ Type: `string`
Additional classname for container. The container renders with a default classname of `react-dropdown-tree-select`.
+### searchTerm
+
+Type: `string`
+
+Initializes or adjusts the active search term. Set to an empty string or `undefined` to turn search mode off.
+
### clearSearchOnChange
Type: `bool`
@@ -256,6 +266,24 @@ Type: `function`
Fires when input box loses focus or the dropdown arrow is clicked again (and the dropdown collapses). This is helpful for setting `dirty` or `touched` flags with forms.
+### onSearchChange
+
+Type: `function`
+
+Called when the search input box is changed with the current search term. This can be fired either through user input or automatically due to `clearSearchOnChange`. Example:
+
+```jsx
+function onSearchChange(searchTerm: str) {
+ if (searchTerm) {
+ console.log('New search term is', searchTerm)
+ } else {
+ console.log('Search mode has been disabled')
+ }
+}
+
+return
+```
+
### data
Type: `Object` or `Array`
@@ -361,6 +389,12 @@ Like `simpleSelect`, you can only select one value; but keeps the tree/children
⚠️ If multiple nodes in data are selected - by setting either `checked` or `isDefaultValue`, only the first visited node stays selected.
+### pageSize
+
+Type: `number` (default: `100`)
+
+Customize the number of nodes displayed in the tree before a scroll to near the bottom is required to load additional nodes.
+
### showPartiallySelected
Type: `bool` (default: `false`)
@@ -428,6 +462,12 @@ Type: `bool` (default: `false`)
`disablePoppingOnBackspace=true` attribute indicates that when a user triggers a 'backspace' keyDown in the empty search bar, the tree will not deselect nodes.
+### disableKeyboardNavigation
+
+Type: `bool` (default: `false`)
+
+`disableKeyboardNavigation=true` prevents keyboard navigation actions from being taken on the nodes when the user triggers a keyDown in the search bar. This restores standard input box semantics.
+
## Styling and Customization
### Default styles
diff --git a/docs/src/stories/Options/index.js b/docs/src/stories/Options/index.js
index b4ce145c..ba8db35c 100644
--- a/docs/src/stories/Options/index.js
+++ b/docs/src/stories/Options/index.js
@@ -11,10 +11,12 @@ class WithOptions extends PureComponent {
super(props)
this.state = {
+ searchTerm: '',
clearSearchOnChange: false,
keepTreeOnSearch: false,
keepOpenOnSelect: false,
mode: 'multiSelect',
+ pageSize: undefined,
inlineSearchInput: false,
showPartiallySelected: false,
disabled: false,
@@ -39,12 +41,18 @@ class WithOptions extends PureComponent {
this.setState({ [value]: !this.state[value] })
}
+ onSearchChange = searchTerm => {
+ this.setState({ searchTerm: searchTerm })
+ }
+
render() {
const {
+ searchTerm,
clearSearchOnChange,
keepTreeOnSearch,
keepOpenOnSelect,
mode,
+ pageSize,
showPartiallySelected,
disabled,
readOnly,
@@ -105,6 +113,26 @@ class WithOptions extends PureComponent {
onChange={e => this.setState({ inlineSearchPlaceholder: e.target.value })}
/>
+