-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose ref of components #314
Comments
I think we should split this in smaller chunks of work, the first piece of work would be listing the components we want to expose the ref of (I.e. a list with checkboxes in this issue) and then start working on a component-per-component basis |
List of components:
|
I had a look at what MUI does for their components that have an equivalent in Bento, and it looks to me that the default behaviour is always forwarding the |
There are cases in which there are multiple refs. E.g. https://mui.com/material-ui/api/input/ has an |
Apart from
Box
, we currently don't forward theref
prop of any of the components. This is rather arbitrary and potentially problematic in some situations.For example, we can't use a
Button
directly as a trigger forMenu
since it doesn't accept aref
.As another example, users of Bento can't programmatically control focus on the components in case they need to, and so on.
This is issue is potentially broad, but I propose we expose
ref
on every component. Where to forwardref
heavily depends on the component itself: in some cases it may make sense to target the top-level wrapper of the component, in other cases we may need to target the native component we're wrapping (think ofNumberInput
for instance).The text was updated successfully, but these errors were encountered: