-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
bug: validateDOMNesting with Dropdown component and Button child #11803
Comments
This docs example is wrong. should be:
the whole docs site will be updated with new examples. it's correct in storybook I think. |
Gotcha, though if we're wrapping the dropdown children, perhaps a nicer api would be to allow button props to be passed with the Dropdown component, for example
or perhaps
just some thoughts 💭 |
Nice! I think the main thing is I think is the trigger can be anything, and we don't dictate how the trigger should look, or what it is. So we can't assume it will always be the Button component. The only reason I think the Dropdown wraps the trigger is so it can apply the correct What we could do though, is maybe if we can check if the Button component is used as a trigger, then we use the radix Think it would be a lot neater API as well if we swap the |
@Ziinc @MildTomato Trying to cut down on Github Issues, this one is two years old and does not look relevant to me anymore, can we close 🙏 ? |
Yea this is no longer an issue, we have been migrating to new Dropdown component |
in case anyone is wondering what the new one is consumed like... note the trigger can be whatever you want it to be. in the example below, we use <DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline">Open</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" align="center">
//...
</DropdownMenuContent>
</DropdownMenu> |
Using the
<Dropdown />
component with a button as per the examples in the docs results in the following console error:seems like the implementation wraps the inner child with a button, so this:
will result in this:
Not sure if this is expected behaviour, as docs example shows Dropdown wrapping a Button
Non-critical bug, just making issue to track.
The text was updated successfully, but these errors were encountered: