themes icon indicating copy to clipboard operation
themes copied to clipboard

`Dialog.Trigger` not work with conditional childs

Open HussainAhmadDev opened this issue 1 year ago • 0 comments

In the provided snippets you can see I wrapped my conditional button with Dialog.Trigger but it does not work for both of the buttons. The one solution was to wrap Dialog.Trigger for both of the buttons in there component means if two conditional buttons than two Dialog.Trigger - but I don't like this approach so need some solution.

 <Dialog.Root>
      <Dialog.Trigger>
        {data ? <EditReceiverButton /> : <AddReceiverButton />}
      </Dialog.Trigger>
      <Dialog.Content className="relative max-w-[1000px]">
        <CloseDialogTrigger />

        <Dialog.Title className="font-sans -tracking-[0.25px]">
          {data ? 'Edit' : 'Add'} Receiver
        </Dialog.Title>

        <ReceiverForm  />
      </Dialog.Content>
 </Dialog.Root>

HussainAhmadDev avatar Oct 24 '24 13:10 HussainAhmadDev