BlogPlaygroundOne

VSnackbar API

ads via vuetify

Props
name
type
default
boolean
false

Applies position: absolute to the content element.

Element | (string & {}) | 'parent' | ComponentPublicInstance
undefined

Explicitly sets the overlay’s activator.

unknown
{}

Apply custom properties to the activator.

string | boolean | Element
false

Specifies which DOM element the overlay content should teleport to. Can be a direct element reference, querySelector string, or true to disable teleporting. Uses body by default.

string | number
undefined

Milliseconds to wait before closing component. Only applies to hover and focus events.

boolean
false

Closes the overlay content when the browser’s back button is pressed or $router.back() is called, cancelling the original navigation. persistent overlays will cancel navigation and animate as if they were clicked outside instead of closing.

boolean
false

Closes component when you click on its content.

{ width: number; height: number }
undefined

Alters the element size fit behind front snackbar in the queue.

string
undefined

Applies specified color to the control - supports utility colors with or without text- prefix (for example success, purple or text-purple) or CSS color (#033 or rgba(255, 0, 0, 0.5)). Find a list of built-in classes on the colors page.

boolean
false

Limits the size of the component and scrim to its offset parent. Implies absolute and attach. (Note: The parent element must have position: relative.).

any
undefined

Applies a custom class to the detached element. This is useful because the content is moved to the beginning of the v-app component (unless the attach prop is provided) and is not targetable by classes passed directly on the component.

any
undefined

Apply custom properties to the content.

boolean
false

Removes the ability to click or target the component.

boolean
false

Forces the component’s content to render when it mounts. This is useful if you have content that will not be rendered in the DOM that you want crawled for SEO.

string | number
undefined

Sets the height for the component.

boolean
false

Displays a loading spinner in the prepend area.

Anchor
'bottom'

Specifies the anchor point for positioning the component, using directional cues to align it either horizontally, vertically, or both…

'static' | 'connected' | LocationStrategyFunction
'static'

A function used to specifies how the component should position relative to its activator.

string | number
undefined

Sets the maximum height for the component.

string | number
undefined

Sets the maximum width for the component.

string | number
undefined

Sets the minimum height for the component.

string | number
undefined

Sets the minimum width for the component.

boolean
false

The v-model value of the component. If component supports the multiple prop, this defaults to an empty array.

string | number
undefined

Sets the opacity of the scrim element. Only applies if scrim is enabled.

string | number
undefined

Milliseconds to wait before opening component. Only applies to hover and focus events.

boolean
undefined

Activate the component when the activator is clicked.

boolean
undefined

Activate the component when the activator is focused.

boolean
false

Activate the component when the activator is hovered.

Anchor | 'auto' | 'overlap'
'auto'

Sets the transition origin on the element. You can find more information on the MDN documentation for transition origin.

'fixed' | 'static' | 'relative' | 'absolute' | 'sticky'
undefined

Sets the position for the component.

string
undefined

Displays an avatar in the prepend area using the provided image source.

  | string
  | (string | [string, number])[]
  | (new () => any)
  | FunctionalComponent
undefined

Displays an icon in the prepend area.

number
undefined

Sets the offset to show collapsed snackbars as a stack. Requires value in pixels.

number
undefined

The index position of this snackbar within a queue.

boolean
false

Reverses the direction of the timer progress bar, filling up instead of depleting.

string | number | boolean
undefined

Designates the border-radius applied to the component. This can be 0, xs, sm, true, lg, xl, pill, circle, and shaped. Find more information on available border radius classes on the Border Radius page.

  | Element
  | (string & {})
  | 'parent'
  | 'cursor'
  | ComponentPublicInstance
  | [number, number]
undefined

For locationStrategy=“connected”, specify an element or array of x,y coordinates that the overlay should position itself relative to. This will be the activator element by default.

string
undefined

Specify content text for the component.

string
undefined

Specify a theme for this component and all of its children.

boolean
false

Removes any applied border-radius from the component.

string | number
5000

Time (in milliseconds) to wait until snackbar is automatically hidden. Use -1 to keep open indefinitely. It is recommended for this number to be between 4000 and 10000. Changes to this property will reset the countdown.

boolean | 'top' | 'bottom'
false

Display a progress bar that counts down until the snackbar closes. Use bottom to change the default placement.

string
undefined

Sets the color of the timer progress bar.

string
undefined

Specify a title text for the component.

string | boolean | (TransitionProps & { component: Component })
'v-snackbar-transition'

Sets the component transition. Can be one of the built in or custom transition. Supports special location-aware mode with slide-auto and scroll-auto

'text' | 'flat' | 'elevated' | 'tonal' | 'outlined' | 'plain'
'elevated'

Applies a distinct style to the component.

boolean
false

Stacks snackbar content on top of the actions (button).

string | number
undefined

Sets the width for the component.

string | number
2000

The z-index used for the component.

Events
name
type
[boolean]

Event that is emitted when the component’s model changes.

Slots
{ isActive: Ref<boolean, boolean> }
{ isActive: boolean; props: Record<string, any> }
never
never
never
never
never

Used to bind styles to v-btn to match MD2 specification.

When used, will activate the component when clicked (or hover for specific components). This manually stops the event propagation. Without this slot, if you open the component through its model, you will need to manually stop the event propagation.

The default Vue slot.

Slot for custom content above the snackbar body.

Adds an item outside the input and before input content.

Slot for the component’s text content.

Slot for the component’s title content.

Exposed
HTMLElement
() => void
HTMLElement
boolean
boolean
HTMLElement
HTMLElement
HTMLElement | [number, number]
(e: Event) => void

Ref to the current activator element.

Function invoked when user clicks outside.

Ref to the current content element.

Used by activator to determine a components position in the global stack order.

Used by activator to determine a components position in the local stack order.

Ref to the root v-overlay element.

Ref to the current scrim element.

Ref to the current target element.

Function used for locationStrategy positioning.

SASS Variables
name
default
1
8px
rgb(var(--v-theme-surface-variant))
settings.$border-radius-root
0 8px
rgb(var(--v-theme-on-surface-variant))
14px 16px
2
rgb(var(--v-theme-surface))
tools.map-deep-get(settings.$typography, 'body-medium', 'size')
tools.map-deep-get(settings.$typography, 'body-medium', 'weight')
tools.map-deep-get(settings.$typography, 'body-medium', 'letter-spacing')
tools.map-deep-get(settings.$typography, 'body-medium', 'line-height')
.62
16px 12px
700
.8
(
  $snackbar-background,
  $snackbar-color,
  $snackbar-elevation,
  $snackbar-plain-opacity,
  'v-snackbar'
)
8px
8px
672px
48px
344px
0
10000