
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
tw-clamp-css
Advanced tools
TailwindCSS v4.0 compatible CSS clamp().
<!-- Adjust font size and line height smoothly from md to xl font size and line height -->
<div class="text-md-xl-clamp">...</div>
<!-- Adjust spacing smoothly using padding, margin or gap -->
<div class="px-8-16-clamp">...</div>
<!-- Control breakpoints the clamp will be between (uses sm to xl if not specified) -->
<div class="m-20-40-clamp-md-lg">...</div>
<!-- Only specify one breakpoint to use the default value for the other -->
<div class="text-sm-base-clamp--md">...</div>
This package offers two ways to use CSS clamp()
functionality in your project: a static CSS file and a dynamic JavaScript plugin.
clamp-[]
to use the plugin.Install the plugin from npm:
npm install -D tw-clamp-css # Or use another package manager
Then add the following at the top of your app.css
or globals.css
file:
@plugin "tw-clamp-css/dynamic";
@import "tw-clamp-css/static";
You can clamp any text or spacing properties.
Structure: <property>-<value1>-<value2>-clamp-<breakpoint1>-<breakpoint2>
sm
for text
, 8
for padding
and margin
etc.sm
for breakpoint1 and xl
for breakpoint2.There is also extra variants added with the following values and breakpoints for the static version:
/* Breakpoints */
--breakpoint-2xs: 24rem;
--breakpoint-xs: 32rem;
/* Spacing */
--spacing-112: 28rem;
--spacing-128: 32rem;
--spacing-144: 36rem;
--spacing-160: 40rem;
--spacing-176: 44rem;
--spacing-192: 48rem;
If you are using the dynamic version, you need to add these manually to your CSS file.
The plugin provides helpers for tailwind-merge
to handle conflicts correctly.
import { extendTailwindMerge } from 'tailwind-merge';
import { withClamp } from 'tw-clamp-css/dynamic/merge';
const twMerge = extendTailwindMerge(withClamp);
import { extendTailwindMerge } from 'tailwind-merge';
import { withClamp } from 'tw-clamp-css/static/merge';
const twMerge = extendTailwindMerge(withClamp);
FAQs
TailwindCSS v4.0 compatible CSS clamp()
We found that tw-clamp-css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.