N
Nuxt11mo ago
toni

Slot "default" invoked outside of the render function

What's the problem here?
<script setup lang="ts">
import {
Dialog,
DialogBackdrop,
DialogCloseTrigger,
DialogContent,
DialogPositioner,
DialogTitle,
DialogTrigger,
} from '@ark-ui/vue'

withDefaults(defineProps<{
maxWidth?: string
}>(), {
maxWidth: '28rem',
})
</script>

<template>
<Dialog
v-slot="{ isOpen }"
:close-on-interact-outside="true"
:close-on-escape-key-down="true"
>
<!-- Trigger -->
<DialogTrigger>
<div>
<slot />
</div>
</DialogTrigger>
<!-- Dialog -->
<Teleport to="body">
<DialogBackdrop />
<DialogPositioner v-if="isOpen" class="dialog-container">
<DialogContent class="dialog-content" :style="{ maxWidth }">
<!-- Header -->
<div class="dialog-header">
<DialogTitle class="dialog-title">
<slot name="title" />
</DialogTitle>
<DialogCloseTrigger>
<div class="close-trigger">
<Icon name="cross" size="1.2em" />
</div>
</DialogCloseTrigger>
</div>
<!-- Content -->
<slot name="content-container">
<div class="scroll-container">
<slot name="content" />
</div>
</slot>
<!-- Footer -->
<div class="dialog-footer">
<slot name="footer" />
</div>
</DialogContent>
</DialogPositioner>
</Teleport>
</Dialog>
</template>
<script setup lang="ts">
import {
Dialog,
DialogBackdrop,
DialogCloseTrigger,
DialogContent,
DialogPositioner,
DialogTitle,
DialogTrigger,
} from '@ark-ui/vue'

withDefaults(defineProps<{
maxWidth?: string
}>(), {
maxWidth: '28rem',
})
</script>

<template>
<Dialog
v-slot="{ isOpen }"
:close-on-interact-outside="true"
:close-on-escape-key-down="true"
>
<!-- Trigger -->
<DialogTrigger>
<div>
<slot />
</div>
</DialogTrigger>
<!-- Dialog -->
<Teleport to="body">
<DialogBackdrop />
<DialogPositioner v-if="isOpen" class="dialog-container">
<DialogContent class="dialog-content" :style="{ maxWidth }">
<!-- Header -->
<div class="dialog-header">
<DialogTitle class="dialog-title">
<slot name="title" />
</DialogTitle>
<DialogCloseTrigger>
<div class="close-trigger">
<Icon name="cross" size="1.2em" />
</div>
</DialogCloseTrigger>
</div>
<!-- Content -->
<slot name="content-container">
<div class="scroll-container">
<slot name="content" />
</div>
</slot>
<!-- Footer -->
<div class="dialog-footer">
<slot name="footer" />
</div>
</DialogContent>
</DialogPositioner>
</Teleport>
</Dialog>
</template>
Related docs: https://ark-ui.com/docs/components/dialog
No description
2 Replies
Hendrik Jan
Hendrik Jan9mo ago
Did you find a solution?
toni
toniOP9mo ago
Nope, it's still present in @ark-ui/vue 0.11.0. Can't get it to work... Rolling with v0.7.0 for now, but it looks like Vue doesn't really get much love in the ArkUI project. React and Solid are already on v1 for a while. Might have to ditch it unfortunately...
Want results from more Discord servers?
Add your server