Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How do I trigger a Dialog from an outside component? #495

Closed
samuelneff opened this issue May 13, 2024 · 0 comments
Closed

How do I trigger a Dialog from an outside component? #495

samuelneff opened this issue May 13, 2024 · 0 comments
Labels
question Further information is requested

Comments

@samuelneff
Copy link

I have a list of icons that I want to trigger a single dialog. The dialog is not showing as a dialog at all; it's just putting the content into the page inline with zero styling or dialog behavior.

My layout is like this:

export function BrowseSection() {
  const [ selectedIcon, setSelectedIcon ] = useState('');

  return (
    <div className={styles.browseSection}>

      <BrowseIconList
        onIconClick={setSelectedIcon}
      />

      <Dialog.Root open={Boolean(selectedIcon)}>
        <Dialog.Content>
          <Dialog.Title>{selectedIcon}</Dialog.Title>

          <div className={styles.browseDetailTable}>
            More content here...
          </div>

          <Dialog.Close>
            <Button onClick={onCloseDialog}>
              Done
            </Button>
          </Dialog.Close>
        </Dialog.Content>
      </Dialog.Root>
    </div>
  );
}

In the actual app these components are further apart from each other in the component hierarchy.

The icon list has over 10,000 items in it when unfiltered.

@vladmoroz vladmoroz added the question Further information is requested label May 14, 2024
@radix-ui radix-ui locked and limited conversation to collaborators May 14, 2024
@vladmoroz vladmoroz converted this issue into discussion #497 May 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants