npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nuxtjs-mobile-vh

v1.1.0

Published

NuxtJS Mobile VH module

Readme

nuxtjs-mobile-vh

npm version npm downloads License Nuxt

A Nuxt module that fixes the viewport height issue on mobile devices by providing a dynamic CSS variable --vh that accurately represents 1% of the viewport height.

The Problem

On mobile browsers (especially iOS Safari), the 100vh unit doesn't account for the browser's address bar, which appears and disappears when scrolling. This causes layout issues where content might be cut off or have unwanted scrollbars.

The Solution

This module calculates the actual viewport height and sets a CSS variable --vh equal to 1% of the real window height. This variable updates dynamically when the window is resized (with debouncing for performance).

Features

  • 📱  Fixes viewport height issues on mobile devices
  • ⚡  Debounced resize handling for optimal performance
  • 🎨  Automatic CSS variable injection (--vh)
  • 🔄  Reactive Vue composable for programmatic access
  • 🎯  Zero configuration required

Quick Setup

Install the module to your Nuxt application:

npx nuxt module add nuxtjs-mobile-vh

That's it! The module will automatically:

  • Add the __vh class to your app container
  • Set the --vh CSS variable on document.documentElement
  • Provide a reactive vh ref through Vue's provide/inject system

Usage

CSS

The module automatically adds the __vh class to your Nuxt app container and sets up the CSS variable. You can use it in your styles:

.my-component {
  height: calc(var(--vh, 1vh) * 100);
  min-height: calc(var(--vh, 1vh) * 100);
}

The module also includes a default style for the __vh class:

.__vh {
  display: flex;
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

Vue Composable

You can also access the vh value programmatically in your components:

<script setup>
const { $vh } = useNuxtApp()
// or
const vh = inject('vh')
</script>

Configuration

You can configure the module in your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['nuxtjs-mobile-vh'],
})

How It Works

  1. On app mount, the module calculates window.innerHeight * 0.01 and sets it as the --vh CSS variable
  2. A debounced resize listener (100ms delay) updates the --vh variable when the window is resized
  3. The __vh class is automatically added to your Nuxt app container
  4. A reactive vh ref is provided through Vue's provide/inject system for programmatic access

Browser Support

Works in all modern browsers that support CSS custom properties (CSS variables). The module is client-side only and won't affect SSR.

License

MIT

Contribution

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release