You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight and fast control to render a select component that can display hierarchical tree data. In addition, the control shows the selection in pills and allows user to search the options for quick filtering and selection.
24
28
25
29
## Table of Contents
26
-
-[Screenshot](#screenshot)
27
-
-[Demo](#example)
28
-
-[Vanilla (no framework)](#vanilla-no-framework)
29
-
-[With Bootstrap](#with-bootstrap)
30
-
-[With Material Design](#with-material-design)
31
-
-[Install](#install)
32
-
-[Peer Dependencies](#peer-dependencies)
33
-
-[Usage](#usage)
34
-
-[Props](#props)
35
-
-[className](#classname)
36
-
-[onChange](#onchange)
37
-
-[onNodeToggle](#onnodetoggle)
38
-
-[data](#data)
39
-
-[placeholderText](#placeholdertext)
40
-
-[Styling and Customization](#styling-and-customization)
41
-
-[Using default styles](#default-styles)
42
-
-[Customizing with Bootstrap, Material Design styles](#customizing-styles)
43
-
-[Performance](#performance)
44
-
-[Search optimizations](#search-optimizations)
45
-
-[Search debouncing](#search-debouncing)
46
-
-[Virtualized rendering](#virtualized-rendering)
47
-
-[Reducing costly DOM manipulations](#reducing-costly-dom-manipulations)
48
-
-[FAQ](#faq)
49
-
-[Development](#development)
50
-
-[License](#license)
30
+
31
+
*[Screenshot](#screenshot)
32
+
*[Demo](#example)
33
+
*[Vanilla (no framework)](#vanilla-no-framework)
34
+
*[With Bootstrap](#with-bootstrap)
35
+
*[With Material Design](#with-material-design)
36
+
*[Install](#install)
37
+
*[Peer Dependencies](#peer-dependencies)
38
+
*[Usage](#usage)
39
+
*[Props](#props)
40
+
*[className](#classname)
41
+
*[onChange](#onchange)
42
+
*[onNodeToggle](#onnodetoggle)
43
+
*[data](#data)
44
+
*[placeholderText](#placeholdertext)
45
+
*[Styling and Customization](#styling-and-customization)
46
+
*[Using default styles](#default-styles)
47
+
*[Customizing with Bootstrap, Material Design styles](#customizing-styles)
48
+
*[Performance](#performance)
49
+
*[Search optimizations](#search-optimizations)
50
+
*[Search debouncing](#search-debouncing)
51
+
*[Virtualized rendering](#virtualized-rendering)
52
+
*[Reducing costly DOM manipulations](#reducing-costly-dom-manipulations)
53
+
*[FAQ](#faq)
54
+
*[Development](#development)
55
+
*[License](#license)
51
56
52
57
## Screenshot
53
58
@@ -56,12 +61,15 @@ A lightweight and fast control to render a select component that can display hie
ReactDOM.render(<DropdownTreeSelect data={data} onChange={onChange} onAction={onAction} onNodeToggle={onNodeToggle} />, document.body) // in real world, you'd want to render to an element, instead of body.
You can import and place a style link directly by referencing it from a CDN.
227
251
228
252
```html
@@ -232,21 +256,23 @@ You can import and place a style link directly by referencing it from a CDN.
232
256
Note: Above example will always fetch the latest version. To fetch a specific version, use `https://unpkg.com/react-dropdown-tree-select@<version>/dist/styles.css`. Visit [unpkg.com](https://unpkg.com/#/) to see other options.
233
257
234
258
#### Using with other bundlers
259
+
235
260
You can reference the files from `node_modules/react-dropdown-tree-select/dist/styles.css` to include in your own bundle via gulp or any other bundlers you have.
236
261
237
262
### Customizing styles
263
+
238
264
Once you import default styles, it is easy to add/override the provided styles to match popular frameworks. Checkout `/docs` folder for some examples.
239
265
240
-
-[With Bootstrap](/docs/examples/bootstrap)
241
-
-[With Material Design ](/docs/examples/material)
266
+
*[With Bootstrap](/docs/examples/bootstrap)
267
+
*[With Material Design ](/docs/examples/material)
242
268
243
269
## Performance
244
270
245
271
### Search optimizations
246
272
247
-
- The tree creates a flat list of nodes from hierarchical tree data to perform searches that are linear in time irrespective of the tree depth or size.
248
-
- It also memoizes each search term, so subsequent searches are instantaneous (almost).
249
-
-Last but not the least, the search employs progressive filtering technique where subsequent searches are performed on the previous search set. E.g., say the tree has 4000 nodes altogether and the user wants to filter nodes that contain the text: "2002". As the user enters each key press the search goes like this:
273
+
* The tree creates a flat list of nodes from hierarchical tree data to perform searches that are linear in time irrespective of the tree depth or size.
274
+
* It also memoizes each search term, so subsequent searches are instantaneous (almost).
275
+
*Last but not the least, the search employs progressive filtering technique where subsequent searches are performed on the previous search set. E.g., say the tree has 4000 nodes altogether and the user wants to filter nodes that contain the text: "2002". As the user enters each key press the search goes like this:
250
276
251
277
```
252
278
key press : 2-----20-----200-----2002
@@ -272,14 +298,17 @@ The tree tries to minimize the DOM manipulations as much as possible. E.g., duri
272
298
Node toggling also achieves the expand/collapse effect by manipulating css classes instead of creating new tree with filtered out nodes.
273
299
274
300
## FAQ
301
+
275
302
### How do I change the placeholder text?
303
+
276
304
The default [placeholder](#placeholdertext) is `Choose...`. If you want to change this to something else, you can use `placeholderText` property to set it.
277
305
278
306
```jsx
279
307
<DropdownTreeSelect placeholderText="Search"/>
280
308
```
281
309
282
310
### How do I tweak styles?
311
+
283
312
Easy style customization is one of the design goals of this component. Every visual aspect of this dropdown can be tweaked without going through extensive hacks. E.g., to change how disabled nodes appear:
284
313
285
314
```css
@@ -291,6 +320,7 @@ Easy style customization is one of the design goals of this component. Every vis
291
320
The css classes needed to overide can be found by inspecting the component via developer tools (chrome/safari/ie) or firebug (firefox). You can also inspect the [source code](/src) or look in [examples](/docs/index.css).
292
321
293
322
### I do not want the default styles, do I need to fork the project?
323
+
294
324
Absolutely not! Simply do not import the styles (webpack) or include it in your html (link tags). Roughly, this is the HTML/CSS skeleton rendered by the component:
295
325
296
326
```pug
@@ -318,11 +348,13 @@ Then include your own custom styles in your project.
318
348
If you believe this aspect can be improved further, feel free to raise an issue.
319
349
320
350
### My question is not listed here
351
+
321
352
Find more questions and their answers in the [issue tracker](https://github.com/dowjones/react-dropdown-tree-select/issues?utf8=%E2%9C%93&q=%20label%3Aquestion%20). If it still doesn't answer your questions, please raise an issue.
0 commit comments