Skip to content

Is there a way to close a dialog? #304

Answered by tmadge
isaacfink asked this question in Help
Discussion options

You must be logged in to vote

Another option that I have used is to bind on the open prop on Dialog.Root and use a button to flip it to false.

<script>
  let open = false;
</script>

<button on:click={() => open = true}>Open</button>
<button on:click={() => open = false}>Close</button>

<Dialog.Root bind:open>
  ...
</Dialog.Root>

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@heirro
Comment options

Comment options

You must be logged in to vote
1 reply
@MentalGear
Comment options

Answer selected by huntabyte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants