Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 LogoVuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One

Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

usePresence

Animation-agnostic mount lifecycle management.


IntermediateApr 1, 2026

Usage

The usePresence composable implements a state machine that controls when content should be in the DOM. It handles lazy mounting, enter/exit timing, and cleanup — without opinion on how animation happens.

ts
import { usePresence } from '@vuetify/v0'
import { shallowRef } from 'vue'

const isOpen = shallowRef(false)

const { isMounted, isPresent, isLeaving, state, done } = usePresence({
  present: isOpen,
  lazy: true,
  immediate: false,
})

// isMounted — controls v-if (true during mounted, present, and leaving)
// state — 'unmounted' | 'mounted' | 'present' | 'leaving'
// done() — call when exit animation finishes

Architecture

usePresence State Machine

Use controls to zoom and pan. Click outside or press Escape to close.

usePresence State Machine

Reactivity

PropertyTypeDescription
stateRef<PresenceState>Current lifecycle state
isMountedRef<boolean>Whether content should be in the DOM
isPresentRef<boolean>Whether content is logically active
isLeavingRef<boolean>Whether an exit is in progress
done() => voidSignal that exit animation is complete

Questions

API Reference

The following API details are for the usePresence composable.

Functions

usePresence

(options: UsePresenceOptions) => UsePresenceReturn

Animation-agnostic mount lifecycle management.

Options

present required

MaybeRefOrGetter<boolean>

Drive visibility.

lazy

boolean | undefined

Delay first mount until present is first true.

Default: false

immediate

boolean | undefined

Auto-resolve LEAVING state next tick if done() not called.

Default: true

Properties

state

Readonly<ShallowRef<PresenceState>>

Current lifecycle state.

isMounted

Readonly<Ref<boolean, boolean>>

Should the element be in the DOM?

isPresent

Readonly<Ref<boolean, boolean>>

Is it logically present?

isLeaving

Readonly<Ref<boolean, boolean>>

Is an exit in progress?

Methods

done

() => void

Call when exit animation finishes.

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/