Skip to content

Commit

Permalink
chore: add new faq points regarding search customization (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbach committed Jun 14, 2024
1 parent f647ec0 commit 796e603
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/docs/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,36 @@ Reference: [#159](https://github.com/lukasbach/react-complex-tree/issues/159)
</div>
</details>

<details><summary>I want the search input to behave differently</summary>
<div>

If you want the search to behave in a completely different way than the built-in search, it is not that
difficult to implement a custom search yourself.

[Here is a sample for a custom search](https://rct.lukasbach.com/storybook/?path=/story/core-finding-items--custom-finder),
with the [implementation for that sample here](https://github.com/lukasbach/react-complex-tree/blob/main/packages/core/src/stories/FindingItems.stories.tsx).

Reference: [#383](https://github.com/lukasbach/react-complex-tree/issues/383)

</div>
</details>

<details><summary>I want the search input to always be visible</summary>
<div>

There is no easy option for this, and a custom reimplementation of the search input might be
a cleaner solution, see the FAQ point above, but this should be doable with some hacks nonetheless.

The search input is rendered whenever the search value is not null, which it is by default.
You can set the search value to an empty string instead of null with `treeRef.setSearch("")`.
Remove the keyboard bindings for "abortSearch". In your renderSearchInput implementation,
overwrite the `onBlur` handler with something new after what `...inputProps` provides to the input.

Reference: [#383](https://github.com/lukasbach/react-complex-tree/issues/383)

</div>
</details>

<details><summary>I want to register a drag-start event or another event that is not available through RCTs API.</summary>
<div>

Expand Down

0 comments on commit 796e603

Please sign in to comment.