Use the title prop to set the title of the Alert.
<template>
<PAlert title="Heads up!" />
</template>
Use the description prop to set the description of the Alert.
<template>
<PAlert title="Heads up!" description="You can change the primary color in your app config." />
</template>
Use the icon prop to show an Icon.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
icon="i-lucide:terminal"
/>
</template>
Use the avatar prop to show an Avatar.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
:avatar="{
src: 'https://github.com/nuxt.png'
}"
/>
</template>
Use the color prop to change the color of the Alert.
<template>
<PAlert
color="neutral"
title="Heads up!"
description="You can change the primary color in your app config."
icon="i-lucide:terminal"
/>
</template>
Use the variant prop to change the variant of the Alert.
<template>
<PAlert
color="neutral"
variant="subtle"
title="Heads up!"
description="You can change the primary color in your app config."
icon="i-lucide:terminal"
/>
</template>
Use the close prop to display a Button to dismiss the Alert.
update:open event will be emitted when the close button is clicked.<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
color="neutral"
variant="outline"
close
/>
</template>
You can pass any property from the Button component to customize it.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
color="neutral"
variant="outline"
:close="{
color: 'primary',
variant: 'outline',
class: 'akar:rounded-full'
}"
/>
</template>
Use the close-icon prop to customize the close button Icon. Defaults to i-lucide:x.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
color="neutral"
variant="outline"
close
close-icon="i-lucide:arrow-right"
/>
</template>
Use the actions prop to add some Button actions to the Alert.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
color="neutral"
variant="outline"
:actions="[
{
label: 'Action 1'
},
{
label: 'Action 2',
color: 'neutral',
variant: 'subtle'
}
]"
/>
</template>
Use the orientation prop to change the orientation of the Alert.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
color="neutral"
variant="outline"
orientation="horizontal"
:actions="[
{
label: 'Action 1'
},
{
label: 'Action 2',
color: 'neutral',
variant: 'subtle'
}
]"
/>
</template>
class propUse the class prop to override the base styles of the Alert.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
class="rounded-none"
/>
</template>
pohon propUse the pohon prop to override the slots styles of the Alert.
<template>
<PAlert
title="Heads up!"
description="You can change the primary color in your app config."
icon="i-lucide:rocket"
:pohon="{
icon: 'akar:size-11'
}"
/>
</template>
| Prop | Default | Type |
|---|
| Slot | Type |
|---|
| Event | Type |
|---|
Below is the theme configuration skeleton for the PAlert. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.
export default defineAppConfig({
pohon: {
alert: {
slots: {
root: '',
wrapper: '',
title: '',
description: '',
icon: '',
avatar: '',
avatarSize: '',
actions: '',
close: ''
},
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
orientation: {
horizontal: {
root: '',
actions: ''
},
vertical: {
root: '',
actions: ''
}
},
title: {
true: {
description: ''
}
}
},
compoundVariants: [],
defaultVariants: {
color: 'primary',
variant: 'solid'
}
}
}
};
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineAppConfig({
pohon: {
alert: {
slots: {
root: '',
wrapper: '',
title: '',
description: '',
icon: '',
avatar: '',
avatarSize: '',
actions: '',
close: ''
},
variants: {
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
orientation: {
horizontal: {
root: '',
actions: ''
},
vertical: {
root: '',
actions: ''
}
},
title: {
true: {
description: ''
}
}
},
compoundVariants: [],
defaultVariants: {
color: 'primary',
variant: 'solid'
}
}
}
};