Skip to content

Commit be71280

Browse files
committed
Add onClick property
1 parent befe810 commit be71280

File tree

11 files changed

+344
-23664
lines changed

11 files changed

+344
-23664
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ All node objects **must** have a unique `value`. This value is serialized into t
104104
| `optimisticToggle` | bool | If true, toggling a partially-checked node will select all children. If false, it will deselect. | `true` |
105105
| `showNodeIcon` | bool | If true, each node will show a parent or leaf icon. | `true` |
106106
| `onCheck` | function | onCheck handler: `function(checked) {}` | `() => {}` |
107+
| `onClick` | function | onClick handler: `function(clicked) {}`. If set, it will be called when clicked on a node label. | `() => {}` |
107108
| `onExpand` | function | onExpand handler: `function(expanded) {}` | `() => {}` |
108109

109110
#### Node Properties

examples/dist/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ <h2>Large Data Example</h2>
6464
<p>The checkbox tree is capable of supporting a large number of nodes at once.</p>
6565
<div id="large-data-example"></div>
6666

67+
<h2>Clickable Labels Example</h2>
68+
<p>
69+
By default, clicking on the node label texts toggle the checkbox value. Providing an <code>onClick</code> property the checkbox will toggle
70+
only when clicking on the checkbox and the provided function will be called when clicking on the node label text.
71+
</p>
72+
<div id="clickable-labels-example"></div>
73+
6774
<footer class="site-footer">
6875
<span class="site-footer-owner">
6976
<a href="https://github.com/jakezatecky/react-checkbox-tree">React Checkbox Tree</a> is maintained by <a href="https://github.com/jakezatecky">jakezatecky</a>.

0 commit comments

Comments
 (0)