Skip to main content
Version: v1 (Current)

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 commit fc6bfb108634735f1657e533206c3f8702ad357d; 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'

Repository source

Props​

NameTypeRequired / defaultDescription
idstring | undefined——
invertboolean | undefined——
themeTheme | undefined——
positionPosition | undefined——
closeButtonPositionCloseButtonPosition | undefined——
hotkeystring[] | undefined——
richColorsboolean | undefined——
expandboolean | undefined——
durationnumber | undefined——
gapnumber | undefined——
visibleToastsnumber | undefined——
closeButtonboolean | undefined——
toastOptionsToastOptions | undefined——
offsetOffset | undefined——
mobileOffsetOffset | undefined——
dir"ltr" | "rtl" | "auto" | undefined——
swipeDirectionsSwipeDirection[] | undefined——
iconsToastIcons | undefined——
containerAriaLabelstring | 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>
`,
}),
}