Skip to content

Commit 5086363

Browse files
committed
fix(Alert/Toast): display actions when using slots
Fixes #3950
1 parent 29fa462 commit 5086363

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/runtime/components/Alert.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.alert || {})
115115
</slot>
116116
</div>
117117

118-
<div v-if="orientation === 'vertical' && actions?.length" :class="ui.actions({ class: props.ui?.actions })">
118+
<div v-if="orientation === 'vertical' && (actions?.length || !!slots.actions)" :class="ui.actions({ class: props.ui?.actions })">
119119
<slot name="actions">
120120
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
121121
</slot>
122122
</div>
123123
</div>
124124

125-
<div v-if="(orientation === 'horizontal' && actions?.length) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
126-
<template v-if="orientation === 'horizontal' && actions?.length">
125+
<div v-if="(orientation === 'horizontal' && (actions?.length || !!slots.actions)) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
126+
<template v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions)">
127127
<slot name="actions">
128128
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
129129
</slot>

src/runtime/components/Toast.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ defineExpose({
144144
</slot>
145145
</ToastDescription>
146146

147-
<div v-if="orientation === 'vertical' && actions?.length" :class="ui.actions({ class: props.ui?.actions })">
147+
<div v-if="orientation === 'vertical' && (actions?.length || !!slots.actions)" :class="ui.actions({ class: props.ui?.actions })">
148148
<slot name="actions">
149149
<ToastAction v-for="(action, index) in actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
150150
<UButton size="xs" :color="color" v-bind="action" />
@@ -153,8 +153,8 @@ defineExpose({
153153
</div>
154154
</div>
155155

156-
<div v-if="(orientation === 'horizontal' && actions?.length) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
157-
<template v-if="orientation === 'horizontal' && actions?.length">
156+
<div v-if="(orientation === 'horizontal' && (actions?.length || !!slots.actions)) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
157+
<template v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions)">
158158
<slot name="actions">
159159
<ToastAction v-for="(action, index) in actions" :key="index" :alt-text="action.label || 'Action'" as-child @click.stop>
160160
<UButton size="xs" :color="color" v-bind="action" />

0 commit comments

Comments
 (0)