Replies: 1 comment 1 reply
-
Yeah, const [open, setOpen] = React.useState(false)
<Command.Item onSelect={() => setOpen(true)}>
...
</Command.Item> or maybe you could put the When #117 is merged I think |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there - I'd like to open a Radix Dialog when I click on a specific
CommandItem
in aCommandList
but cannot figure out how to do so.I found a discussion on the Radix GitHub where they provided a solution for opening a Dialog from a
DropdownMenu
Here is the discussion: radix-ui/primitives#837
Here is that example: https://codesandbox.io/s/dropdownmenu-dialog-items-r9sq1q
However I cannot take the
DropdownWithDialogItemsSolution2
(from the codesandbox) and apply it to aCommandItem
because it seems like theonClick
event is captured byCommandItem
which is necessary for theDialog.Trigger
to know when to open theDialog.Content
...I think?I was wondering if there was a way to trigger the
click
event on theCommandItem
so that I can trigger the Dialog to open?Here's what I currently do, at the bottom beneath my
Command
, I add aButton
as the Dialog trigger. However, I'd like to just do the same for items in myCommandList
instead of having to convert them toButton
's that have click events.Happy to add a code example, but wondering if anyone has come across this and found a viable solution or if I'm just missing something. Let me know how I can help, thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions