fix(Alert): allow actions wrap (#3083)

This commit is contained in:
Alex
2025-01-13 14:46:45 +01:00
committed by GitHub
parent 1d54fd3e2d
commit e7c10bcb0d
4 changed files with 46 additions and 5 deletions

View File

@@ -11,6 +11,46 @@ const actions = (color: string) => [{
}
}]
const multipleActions = (color: string) => [
{
label: 'Action',
color: color as any,
click() {
console.log('Action clicked')
}
},
{
label: 'Another action',
color: color as any,
click() {
console.log('Another action clicked')
}
},
{
label: 'One more action',
color: color as any,
click() {
console.log('One more action clicked')
}
},
{
label: 'And one more',
color: color as any,
icon: 'i-lucide-info',
click() {
console.log('And one more clicked')
}
},
{
label: 'Last one',
color: color as any,
icon: 'i-lucide-info',
click() {
console.log('Last one clicked')
}
}
]
const data = {
title: 'Heads up!',
description: 'You can change the primary color in your app config.',
@@ -28,6 +68,7 @@ const data = {
<UAlert :title="data.title" :icon="data.icon" :close="data.close" :actions="actions('neutral')" />
<UAlert :title="data.title" :icon="data.icon" :close="data.close" :description="data.description" />
<UAlert :title="data.title" :avatar="{ src: 'https://github.com/benjamincanac.png' }" :close="data.close" :description="data.description" />
<UAlert :title="data.title" :icon="data.icon" description="example with multiple actions." :actions="multipleActions('neutral')" />
</div>
<div class="flex items-center gap-2">