Skip to content

Commit 796e603

Browse files
committed
chore: add new faq points regarding search customization (#383)
1 parent f647ec0 commit 796e603

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/docs/docs/faq.mdx

+30
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,36 @@ Reference: [#159](https://github.com/lukasbach/react-complex-tree/issues/159)
179179
</div>
180180
</details>
181181

182+
<details><summary>I want the search input to behave differently</summary>
183+
<div>
184+
185+
If you want the search to behave in a completely different way than the built-in search, it is not that
186+
difficult to implement a custom search yourself.
187+
188+
[Here is a sample for a custom search](https://rct.lukasbach.com/storybook/?path=/story/core-finding-items--custom-finder),
189+
with the [implementation for that sample here](https://github.com/lukasbach/react-complex-tree/blob/main/packages/core/src/stories/FindingItems.stories.tsx).
190+
191+
Reference: [#383](https://github.com/lukasbach/react-complex-tree/issues/383)
192+
193+
</div>
194+
</details>
195+
196+
<details><summary>I want the search input to always be visible</summary>
197+
<div>
198+
199+
There is no easy option for this, and a custom reimplementation of the search input might be
200+
a cleaner solution, see the FAQ point above, but this should be doable with some hacks nonetheless.
201+
202+
The search input is rendered whenever the search value is not null, which it is by default.
203+
You can set the search value to an empty string instead of null with `treeRef.setSearch("")`.
204+
Remove the keyboard bindings for "abortSearch". In your renderSearchInput implementation,
205+
overwrite the `onBlur` handler with something new after what `...inputProps` provides to the input.
206+
207+
Reference: [#383](https://github.com/lukasbach/react-complex-tree/issues/383)
208+
209+
</div>
210+
</details>
211+
182212
<details><summary>I want to register a drag-start event or another event that is not available through RCTs API.</summary>
183213
<div>
184214

0 commit comments

Comments
 (0)