Skip to content

Commit

Permalink
[docs] Remove the incorrect info about useButton's ref parameter (#36883
Browse files Browse the repository at this point in the history
)
  • Loading branch information
michaldudak authored Apr 17, 2023
1 parent f1a50ab commit 5a50316
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/data/base/components/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,17 @@ With hooks, you can take full control over how your component is rendered, and d
You may not need to use hooks unless you find that you're limited by the customization options of their component counterparts—for instance, if your component requires significantly different [structure](#anatomy).
:::

The `useButton` hook requires the `ref` of the element it's used on.

The following demo shows how to build the same buttons as those found in the [Basics](#basics) section above, but with the `useButton` hook:

{{"demo": "UseButton.js", "defaultCodeOpen": true}}

If you use a ref to store a reference to the button, pass it to the `useButton`'s `ref` parameter, as shown in the demo above.
It will get merged with a ref used internally in the hook.

:::warning
Do not add the `ref` parameter to the button element manually, as the correct ref is already a part of the object returned by the `getRootProps` function.
:::

## Customization

:::info
Expand Down

0 comments on commit 5a50316

Please sign in to comment.