Using a regular button to trigger a Dialog #8144
-
Hi, I was hoping with the new onPress change we would be able to use native buttons to trigger things like Dialogs, like this: import {Dialog, DialogTrigger, Heading, Input, Label, Modal, TextField} from 'react-aria-components';
<DialogTrigger>
<button>Sign up…</button>
<Modal>
<Dialog>
<form>
<Heading slot="title">Sign up</Heading>
<TextField autoFocus>
<Label>First Name</Label>
<Input />
</TextField>
<TextField>
<Label>Last Name</Label>
<Input />
</TextField>
<Button slot="close" style={{ marginTop: 8 }}>
Submit
</Button>
</form>
</Dialog>
</Modal>
</DialogTrigger> But this does not work. I can work around this using the |
Beta Was this translation helpful? Give feedback.
Answered by
reidbarber
Apr 24, 2025
Replies: 1 comment 1 reply
-
This the use case |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Gawdfrey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This the use case
<Pressable/>
was added for. Is it causing any issues? I think the only other option is making it controlled.