Skip to content

Commit

Permalink
feat: expose open value
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Jun 15, 2024
1 parent 3795ece commit 75abdcd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/vaul-vue/src/DrawerRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ const props = withDefaults(defineProps<DrawerRootProps>(), {
const emit = defineEmits<DrawerRootEmits>()
const slots = defineSlots<{
default: (props: {
open: typeof isOpen.value
}) => any
}>()
const fadeFromIndex = computed(() => props.fadeFromIndex ?? (props.snapPoints && props.snapPoints.length - 1))
const open = useVModel(props, 'open', emit, {
Expand Down Expand Up @@ -71,6 +77,10 @@ function handleOpenChange(o: boolean) {
isOpen.value = o
}
}
defineExpose({
open: isOpen,
})
</script>

<template>
Expand All @@ -79,7 +89,7 @@ function handleOpenChange(o: boolean) {
:modal="modal"
@update:open="handleOpenChange"
>
<slot />
<slot :open="isOpen" />
</DialogRoot>
</template>

Expand Down

0 comments on commit 75abdcd

Please sign in to comment.