# @csstools/postcss-logical-viewport-units

> Use vb and vi length units in CSS

Latest version **4.0.1** (published 2026-09-06) · MIT-0 license · 0 weekly downloads

## Install

```sh
npm install @csstools/postcss-logical-viewport-units
pnpm add @csstools/postcss-logical-viewport-units
yarn add @csstools/postcss-logical-viewport-units
bun add @csstools/postcss-logical-viewport-units
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2026-09-06 |
| First published | 2023-01-19 |
| Weekly downloads | 0 |
| License | MIT-0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 |
| Dependencies | 3 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1052 |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | block, css, inline, logical, padding, postcss, postcss-plugin, viewport units |

## Links

- npm: https://www.npmjs.com/package/@csstools/postcss-logical-viewport-units
- Repository: https://github.com/csstools/postcss-plugins
- Homepage: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical-viewport-units#readme
- Issues: https://github.com/csstools/postcss-plugins/issues
- Funding: https://github.com/sponsors/csstools
- npm.io page: https://npm.io/package/@csstools/postcss-logical-viewport-units

## Dependencies (3)

- [@csstools/utilities](https://npm.io/package/@csstools/utilities.md) ^3.0.0
- [@csstools/css-tokenizer](https://npm.io/package/@csstools/css-tokenizer.md) ^4.0.0
- [@csstools/postcss-progressive-custom-properties](https://npm.io/package/@csstools/postcss-progressive-custom-properties.md) ^5.1.3

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2026-09-06
- 4.0.0 — 2026-01-14
- 3.0.4 — 2025-05-27
- 3.0.3 — 2024-11-01
- 3.0.2 — 2024-10-10
- 3.0.1 — 2024-08-18
- 3.0.0 — 2024-08-03
- 2.0.11 — 2024-07-06
- 2.0.10 — 2024-06-29
- 2.0.9 — 2024-05-04
- 2.0.8 — 2024-05-04
- 2.0.7 — 2024-03-13
- 2.0.6 — 2024-02-19
- 2.0.5 — 2023-12-31
- 2.0.4 — 2023-12-15
- … 8 more at https://npm.io/package/@csstools/postcss-logical-viewport-units/versions

## README

# PostCSS Logical Viewport Units [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]

`npm install @csstools/postcss-logical-viewport-units --save-dev`

[PostCSS Logical Viewport Units] lets you easily use `vb` and `vi` length units following the [CSS-Values-4 Specification].

```css
.foo {
	margin: 10vi 20vb;
}

/* becomes */

.foo {
	margin: 10vw 20vh;
	margin: 10vi 20vb;
}
```

## Usage

Add [PostCSS Logical Viewport Units] to your project:

```bash
npm install postcss @csstools/postcss-logical-viewport-units --save-dev
```

Use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssLogicalViewportUnits = require('@csstools/postcss-logical-viewport-units');

postcss([
	postcssLogicalViewportUnits(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```



## Options

### inlineDirection

The `inlineDirection` option allows you to specify the direction of the inline axe. The default value is `left-to-right`, which would match any latin language.

**You should tweak this value so that it is specific to your language and writing mode.**

```js
postcssLogicalViewportUnits({
	inlineDirection: 'top-to-bottom'
})
```

```css
.foo {
	margin: 10vi 20vb;
}

/* becomes */

.foo {
	margin: 10vh 20vw;
	margin: 10vi 20vb;
}
```

Each direction must be one of the following:

- `top-to-bottom`
- `bottom-to-top`
- `left-to-right`
- `right-to-left`

Please do note that transformations won't do anything particular for `right-to-left` or `bottom-to-top`.

### preserve

The `preserve` option determines whether the original notation
is preserved. By default, it is preserved.

```js
postcssLogicalViewportUnits({ preserve: false })
```

```css
.foo {
	margin: 10vi 20vb;
}

/* becomes */

.foo {
	margin: 10vw 20vh;
}
```

[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#logical-viewport-units
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-logical-viewport-units

[PostCSS]: https://github.com/postcss/postcss
[PostCSS Logical Viewport Units]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical-viewport-units
[CSS-Values-4 Specification]: https://www.w3.org/TR/css-values-4/#viewport-relative-units

---
_Source: https://npm.io/package/@csstools/postcss-logical-viewport-units · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
