tailwindcss-calc weekly downloads statistics
By oswaldohuillca · npm · Tailwind plugins
A Tailwind CSS v4 plugin built entirely with CSS that provides responsive utilities using `calc()` and `clamp()` based on viewport width.
tailwindcss-calc has 23 recorded weekly downloads on npm, a decrease of 88.7% over the past 30 days, ranking #2962 of 3,247 tracked listings.
About tailwindcss-calc
Tailwind CSS v4 Calc Plugin
A Tailwind CSS v4 plugin built entirely with CSS that provides responsive utilities using calc() and clamp() based on viewport width.
Write the pixel values from your mockup — w-100, p-20, text-32 — and every one of them scales with the viewport. One breakpoint, two design references, no JavaScript.
🚀 Features
- ✅ 100% CSS - No JavaScript required
- ✅ Tailwind CSS v4 - Compatible with the latest version
- ✅ Viewport-based Scaling - All utilities scale responsively using
calc()andclamp() - ✅ Comprehensive Utilities - Width, height, padding, margin, typography, positioning, and more
- ✅ One breakpoint -
mdswaps the base reference; nomd:ladder for sizing - ✅ Customizable - Set the base widths to match your own mockups
📦 Installation
npm install tailwindcss-calc
# or
bun add tailwindcss-calc
# or
pnpm add tailwindcss-calc
🚀 Quick Start
After installation, create your CSS file:
/* styles.css */
@import "tailwindcss";
@import "tailwindcss-calc";
/* Your two design references — this is the entire configuration */
@layer theme {
:root {
--window-width: 375; /* mobile mockup */
}
@variant md {
:root {
--window-width: 1440; /* desktop mockup */
}
}
}
Then use the utilities in your HTML:
<div class="w-500 h-300 p-20 m-10">
<h1 class="text-32 mb-20">Hello World</h1>
<p class="text-16 leading-24">Responsive content</p>
</div>
The defaults are already 375 / 1440, so you can skip the @layer theme
block entirely if those match your mockups.
🛠️ Development
To run the example locally:
Development
bun run dev
# or: npm run dev
Open your browser at http://localhost:5173 to see the demo.
Build
bun run build
Preview
bun run preview
🎨 How It Works
All utilities use this formula to scale based on viewport width:
calc(value * clamp(0px, 100vw, max-width) / base-width)
The formula is centralized in a single --calc-ratio variable, so every
utility multiplies its numeric value by the same viewport-based factor.
Default configuration (mobile-first):
- Base width:
375px - Max width:
375px - At the
mdbreakpoint (≥48rem) the base scales up to1440px
This means w-100 will be:
- On a 320px screen: ~85px
- At 375px (design base): 100px
- Above 375px: 100px (capped) until the
mdbreakpoint - At
md, base becomes1440, so 768px → ~53px and 1440px → 100px - Above 1440px: 100px (capped)
📚 Available Utilities
Width & Height
<div class="w-100 h-200">...</div>
<div class="size-50">...</div>
<div class="min-w-300 max-w-500">...</div>
<div class="min-h-400 max-h-600">...</div>
Padding
<div class="p-20">...</div>
<div class="px-30 py-40">...</div>
<div class="pt-10 pb-10 pl-15 pr-15">...</div>
Margin
<div class="m-20">...</div>
<div class="mx-auto my-30">...</div>
<div class="mt-10 mb-20 ml-5 mr-5">...</div>
Typography
<h1 class="text-48 leading-60">Title</h1>
<p class="text-16 tracking-2">Paragraph</p>
<span class="word-spacing-4">Text</span>
Gap (Flexbox & Grid)
<div class="flex gap-20">...</div>
<div class="grid gap-x-30 gap-y-40">...</div>
<div class="grid col-gap-25 row-gap-25">...</div>
Border Radius
<div class="rounded-10">...</div>
<div class="rounded-t-20 rounded-b-10">...</div>
<div class="rounded-l-8 rounded-r-8">...</div>
Positioning
<div class="top-50 left-100">...</div>
<div class="bottom-20 right-30">...</div>
<div class="inset-10">...</div>
<div class="inset-x-20 inset-y-30">...</div>
Transform
<div class="translate-x-50">...</div>
<div class="translate-y-100">...</div>
Borders
<div class="border-w-2">...</div>
<div class="border-t-1 border-b-1">...</div>
<div class="border-l-3 border-r-3">...</div>
Outline
<div class="outline-offset-4">...</div>
Container
<div class="container">Centered content with max-width</div>
📁 Project Structure
tailwindcss-calc/
├── src/
│ └── plugin.css # Main plugin file
├── example/ # Demo folder
│ ├── index.html # Demo page
│ ├── index.css # Example CSS
│ ├── package.json # Example dependencies
│ └── vite.config.js # Vite configuration
├── package.json # Root package.json
├── LICENSE # MIT License
└── README.md # This file
🔧 How to Use in Your Project
Option 1: Install from npm (Recommended)
- Install the package:
npm install tailwindcss-calc
- Import in your CSS file:
@import "tailwindcss";
@import "tailwindcss-calc";
That's it! All utilities are now available.
Option 2: Import from node_modules
@import "tailwindcss";
@import "tailwindcss-calc/src/plugin.css";
Option 3: Copy the source
Copy the content from src/plugin.css and paste it into your main CSS file after @import "tailwindcss".
Important: Use @import for CSS files, not @plugin. The @plugin directive is only for JavaScript files in Tailwind CSS v4.
⚙️ Customization
Override --window-width in your own stylesheet, after the import — there's
no need to edit src/plugin.css. Set it once for mobile and once at md:
@import "tailwindcss";
@import "tailwindcss-calc";
@layer theme {
:root {
--window-width: 390; /* your mobile artboard */
}
@variant md {
:root {
--window-width: 1920; /* your desktop artboard */
}
}
}
Match these to the artboard widths in your design file. Every utility recalculates automatically — there is nothing else to configure.
Use @variant md, not a raw media query
/* ✅ mobile-first, matches the plugin */
@variant md {
:root { --window-width: 1440; }
}…
Description from the npm listing.
- tailwindcss
- tailwindcss-plugin
- css
- utility-classes
- responsive
- viewport-based
- calc
- clamp
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Tailwind plugins plugins
All 20 tailwindcss-calc alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/tailwindcss-calc. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.