Skip to content

Dynamic viewport height available through CSS custom properties (--tenka-viewport-height)

Notifications You must be signed in to change notification settings

vasilenka/use-viewport-height

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-viewport-height

Install

npm install use-viewport-height
// or
yarn add use-viewport-height

Usage

// 1. Import the hooks
import useViewportHeight from 'use-viewport-height'

const App = () => {

  // 2. Add it to your app
  useViewportHeight()

  return (...)
}

and anywhere in your css file you can access the viewport height with: var(--tenka-viewport-height)

.my-div {
  height: var(--tenka-viewport-height);
}

About

Dynamic viewport height available through CSS custom properties (--tenka-viewport-height)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages