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

tailwindcss-text-box-trim

v1.0.4

Published

Tailwind CSS v4 utilities for text-box-trim and text-box-edge

Downloads

536

Readme

tailwindcss-text-box-trim

Perfect typography spacing for Tailwind CSS v4+

npm version GitHub GitHub stars

Before and after comparison of text-box-trim behavior

Before: Standard text with excess space. After: Text with text-box-trim applied, removing the excess space for perfect alignment.

Create pixel-perfect typographical layouts with precise control over the vertical spacing of text 🤩

Eliminate annoying leading whitespace and cap-height alignment issues with standard CSS. This package provides Tailwind CSS utilities for the CSS Text Box Trim specification.

Why use this?

Standard web typography often includes "internal leading" (extra space above and below the text glyphs) which makes it difficult to align text containers precisely with images, buttons, or other elements.

text-box-trim solves this by cropping that extra space, making your text behave more like a standard box model element.

Use text-box-trim along with text-box-edge to control which sides of the text box are trimmed and how much space to trim.

Installation

Install the package via npm:

npm install tailwindcss-text-box-trim

Usage

This package is designed for Tailwind CSS v4+.

Import the CSS in your main CSS file (e.g., global.css):

@import "tailwindcss";
@import "tailwindcss-text-box-trim";

Browser Support

text-box-trim is baseline available in Chrome 133+ and Safari 18.2+.

Firefox support is pending.

Can I use

Utilities

box-trim-*

Control which sides of the text box are trimmed.

  • box-trim-both: Trims space from both start (top) and end (bottom).
  • box-trim-start: Trims space from the start (top) only.
  • box-trim-end: Trims space from the end (bottom) only.
  • box-trim-none: Removes trimming.

box-edge-*

Define the reference edge for trimming.

  • box-edge-text: Trims to the text edge (default).
  • box-edge-cap: Trims to the cap height (top of capital letters). Perfect for aligning headers.
  • box-edge-ex: Trims to the x-height.
  • box-edge-alphabetic: Trims to the alphabetic baseline.
  • box-edge-ideographic: Trims to the ideographic baseline (CJK).

Usage with tailwind-merge

Since these utilities do not collide with standard Tailwind classes (like text-* colors or sizes), configuration is optional.

However, if you want to support deduplication (e.g., ensuring box-trim-both overrides box-trim-none properly when both are present), you can configure it as follows:

import { extendTailwindMerge } from "tailwind-merge";

export const twMerge = extendTailwindMerge({
  extend: {
    classGroups: {
      "box-trim": [{ "box-trim": ["both", "start", "end", "none"] }],
      "box-edge": [
        { "box-edge": ["text", "cap", "ex", "alphabetic", "ideographic"] },
      ],
    },
  },
});