mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 13:17:57 +01:00
feat(Alert): add actions slot (#1785)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -175,6 +175,12 @@ Use the `#avatar` slot to customize the displayable avatar.
|
|||||||
|
|
||||||
:component-example{component="alert-example-avatar"}
|
:component-example{component="alert-example-avatar"}
|
||||||
|
|
||||||
|
### `actions` :u-badge{label="New" class="align-middle ml-2 !rounded-full" variant="subtle"}
|
||||||
|
|
||||||
|
Use the `#actions` slot to add custom user interaction elements.
|
||||||
|
|
||||||
|
:component-example{component="alert-example-actions"}
|
||||||
|
|
||||||
## Props
|
## Props
|
||||||
|
|
||||||
:component-props
|
:component-props
|
||||||
|
|||||||
@@ -20,13 +20,17 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
|
<div v-if="(description || $slots.description) && (actions.length || $slots.actions)" :class="ui.actions">
|
||||||
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
<slot name="actions">
|
||||||
|
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
||||||
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
|
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
|
||||||
<template v-if="!description && !$slots.description && actions.length">
|
<template v-if="!description && !$slots.description && (actions.length || $slots.actions)">
|
||||||
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
<slot name="actions">
|
||||||
|
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
|
||||||
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
|
<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
|
||||||
|
|||||||
Reference in New Issue
Block a user