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

useHydration

The useHydration composable provides SSR hydration state management, allowing you to detect when your application has been hydrated on the client side. This is essential for preventing hydration mismatches and controlling when browser-only features should activate.

Intermediate95.1% coverageJan 11, 2026

Installation

Install the Hydration plugin in your app’s entry point:

main.ts
import { createApp } from 'vue'
import { createHydrationPlugin } from '@vuetify/v0'
import App from './App.vue'

const app = createApp(App)

app.use(createHydrationPlugin())

app.mount('#app')

Usage

Once the plugin is installed, use the useHydration composable in any component:

UseHydration
<script setup lang="ts">
  import { useHydration } from '@vuetify/v0'

  const hydration = useHydration()
</script>

<template>
  <div>
    <p v-if="hydration.isHydrated.value">
      Application is hydrated - browser features available
    </p>
    <p v-else>
      Rendering on server or waiting for hydration
    </p>
  </div>
</template>

Architecture

useHydration uses the plugin pattern with a simple boolean state:

Hydration Plugin

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

Hydration Plugin

API Reference

The following API details are for the useHydration composable.

Functions

createHydration

() => E

Creates a new hydration instance.

createHydrationContext

(_options?: HydrationContextOptions) => ContextTrinity<E>

Creates a new hydration context trinity.

createHydrationPlugin

(_options?: HydrationPluginOptions) => any

Creates a new hydration plugin.

useHydration

(namespace?: string) => E

Returns the current hydration instance.

Properties

isHydrated

Readonly<ShallowRef<boolean>>

True when root component has mounted (hydration complete)

isSettled

Readonly<ShallowRef<boolean>>

True after first tick post-hydration (safe for animations after state restoration)

Methods

hydrate

() => void

Mark hydration as complete

settle

() => void

Mark as settled (called automatically after nextTick post-hydration)

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/