Skip to content

Commit 3c971be

Browse files
committed
chore: checkbox async propagation docs
1 parent f868647 commit 3c971be

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

packages/core/src/mddocs-entry.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SyncDataLoaderFeatureDef } from "./features/sync-data-loader/types";
1010
import { TreeFeatureDef } from "./features/tree/types";
1111
import { PropMemoizationFeatureDef } from "./features/prop-memoization/types";
1212
import { KeyboardDragAndDropFeatureDef } from "./features/keyboard-drag-and-drop/types";
13+
import type { CheckboxesFeatureDef } from "./features/checkboxes/types";
1314

1415
export * from ".";
1516

@@ -167,3 +168,15 @@ export type TreeFeatureTreeInstance<T> = TreeFeatureDef<T>["treeInstance"];
167168
/** @interface */
168169
export type TreeFeatureItemInstance<T> = TreeFeatureDef<T>["itemInstance"];
169170
export type TreeFeatureHotkeys<T> = TreeFeatureDef<T>["hotkeys"];
171+
172+
/** @interface */
173+
export type CheckboxesFeatureConfig<T> = CheckboxesFeatureDef<T>["config"];
174+
/** @interface */
175+
export type CheckboxesFeatureState<T> = CheckboxesFeatureDef<T>["state"];
176+
/** @interface */
177+
export type CheckboxesFeatureTreeInstance<T> =
178+
CheckboxesFeatureDef<T>["treeInstance"];
179+
/** @interface */
180+
export type CheckboxesFeatureItemInstance<T> =
181+
CheckboxesFeatureDef<T>["itemInstance"];
182+
export type CheckboxesFeatureHotkeys<T> = CheckboxesFeatureDef<T>["hotkeys"];

packages/docs/docs/2-features/10-checkboxes.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,24 @@ always be directly inferred from their leafs.
3838

3939
:::warning
4040

41-
Trees with `propagateCheckedState=true` is currently only supported for synchronous trees, not trees using the Async
42-
Data Loader feature.
41+
If you use asynchronous trees with `propagateCheckedState=true`, checking an item will trigger loading
42+
children recursively for all descendants.
4343

4444
:::
4545

46-
The default for `propagateCheckedState` is `true` for synchronous trees, and `false` for asynchronous trees.
47-
4846
Below, you can experiment with the behavior for various combinations of `propagateCheckedState` and `canCheckFolders`:
4947

5048
<DemoBox tags={["feature/checkbox"]} initialStory="react-checkboxes-configurability--configurability" />
5149

50+
## Asynchronous checkbox propagation
51+
52+
You can also use checkbox propagation with trees that use async data loaders. If a checkbox is clicked, all nested
53+
descendants IDs that are not yet loaded will be loaded via the `getChildren` or `getChildrenWithData` APIs, and
54+
their checkbox state will be updated accordingly. While they are loading, the state variable `loadingCheckPropagationItems`
55+
can be used to render a loading spinner on checkboxes that are loading.
56+
57+
<DemoBox tags={["feature/checkbox"]} initialStory="react-checkboxes-async-configurability--async-configurability" />
58+
5259
## Further customizing checkbox behavior
5360

5461
Similar to other Headless Tree features, you can customize feature behavior by overwriting any of the publicly

0 commit comments

Comments
 (0)