Sonner
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
Toaster
import { Toaster } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
id | string | undefined | — | — |
invert | boolean | undefined | — | — |
theme | Theme | undefined | — | — |
position | Position | undefined | — | — |
closeButtonPosition | CloseButtonPosition | undefined | — | — |
hotkey | string[] | undefined | — | — |
richColors | boolean | undefined | — | — |
expand | boolean | undefined | — | — |
duration | number | undefined | — | — |
gap | number | undefined | — | — |
visibleToasts | number | undefined | — | — |
closeButton | boolean | undefined | — | — |
toastOptions | ToastOptions | undefined | — | — |
offset | Offset | undefined | — | — |
mobileOffset | Offset | undefined | — | — |
dir | "ltr" | "rtl" | "auto" | undefined | — | — |
swipeDirections | SwipeDirection[] | undefined | — | — |
icons | ToastIcons | undefined | — | — |
containerAriaLabel | string | undefined | — | — |
Examples
These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { toast } from 'vue-sonner'
import { Toaster } from '.'
import { Button } from '../button'
{
render: () => ({
components: { Toaster, Button },
setup() {
function showToast() {
toast('Event has been created')
}
return { showToast }
},
template: `
<div>
<Toaster />
<Button @click="showToast">Show Toast</Button>
</div>
`,
}),
}
AllTypes
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { toast } from 'vue-sonner'
import { Toaster } from '.'
import { Button } from '../button'
{
name: 'All Types',
render: () => ({
components: { Toaster, Button },
setup() {
function showDefault() {
toast('Event has been created')
}
function showSuccess() {
toast.success('Event has been created')
}
function showError() {
toast.error('Event could not be created')
}
function showWarning() {
toast.warning('Event may have issues')
}
function showInfo() {
toast.info('Event details updated')
}
function showLoading() {
toast.loading('Creating event...')
}
return { showDefault, showSuccess, showError, showWarning, showInfo, showLoading }
},
template: `
<div>
<Toaster />
<div class="flex flex-wrap items-center gap-4">
<Button variant="outline" @click="showDefault">Default</Button>
<Button variant="outline" @click="showSuccess">Success</Button>
<Button variant="outline" @click="showError">Error</Button>
<Button variant="outline" @click="showWarning">Warning</Button>
<Button variant="outline" @click="showInfo">Info</Button>
<Button variant="outline" @click="showLoading">Loading</Button>
</div>
</div>
`,
}),
}
WithDescription
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { toast } from 'vue-sonner'
import { Toaster } from '.'
import { Button } from '../button'
{
name: 'With Description',
render: () => ({
components: { Toaster, Button },
setup() {
function showToast() {
toast('Event Created', {
description: 'Monday, January 3rd at 6:00pm',
})
}
return { showToast }
},
template: `
<div>
<Toaster />
<Button @click="showToast">Show Toast with Description</Button>
</div>
`,
}),
}