Skip to content
Discussion options

You must be logged in to vote

Hey @Taiyangqihuo, yes this is possible. The simplest strategy for this is to handle the data flow both in/out for the open state. This is possible by combining:

  • The open prop (data in)
  • The onOpenChange() event (data out)

This can be done like so:

let someDialog = $state(false);
<Dialog open={someDialog} onOpenChange={(e) => (someDialog = e.open)}>...</Dialog>

This pattern is not limited only to the Dialog, but actually the standard across all components. We showcase examples of this for a number of them. Take the Switch for example:

https://www.skeleton.dev/docs/svelte/framework-components/switch

<script lang="ts">
	import { Switch } from '@skeletonlabs/skeleton-svelte';

	let checked = 

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Taiyangqihuo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants