Tailwind CSS Container Queries

An official Tailwind CSS plugin that adds container-query utilities (@container, @lg, @xl, etc.) for Tailwind CSS v3.2+

Library
npm
v0.1.1
1,434 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
42 /100 Fair
Development Activity 8
Maintenance 20
Community 44
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 75
Code Quality 78
Innovation 55
Learning Curve 92

This plugin brings CSS container queries to Tailwind CSS v3.2+ by adding an @container class to mark an element as a query container and a set of @xs through @7xl variant utilities to style descendants conditionally based on that container’s width, rather than the viewport’s. It mirrors Tailwind’s existing responsive-variant syntax (@lg:underline reads just like lg:underline) so teams already fluent in Tailwind’s breakpoint system can pick up container queries with almost no new syntax to learn. Named containers (@container/main paired with @lg/main:underline) let a component style itself relative to a specific named ancestor when multiple nested containers are in play, and arbitrary values (@[17.5rem]:underline) cover one-off sizes outside the default scale.

As of Tailwind CSS v4.0, container queries are supported natively in the core framework, and the maintainers explicitly note in the README that this plugin is no longer required for v4 projects. It remains relevant for the substantial number of codebases still on Tailwind v3.2+ that need container-query utilities without a full v4 migration, and the repository is kept around by Tailwind Labs primarily to support that legacy version.

What You Get

  • An @container utility class to mark any element as a CSS container-query container
  • A full @xs through @7xl variant scale (20rem-80rem) mirroring Tailwind’s existing breakpoint naming
  • Named containers (@container/name + @lg/name:) for targeting a specific ancestor when containers are nested
  • Arbitrary-value container queries (@[17.5rem]:underline) for one-off sizes outside the default scale
  • An @container-normal utility to remove container behavior from an element conditionally
  • Configuration prefix support consistent with a project’s existing Tailwind prefix setup

Common Use Cases

  • Building reusable card/widget components that adapt their layout to their container’s width, not the page viewport
  • Sidebar or panel components that need different styling when narrow versus wide, independent of overall screen size
  • Design-system components meant to be dropped into varying layout contexts (dashboards, grids, modals) with consistent responsive behavior
  • Bridging container-query needs on Tailwind v3.2+ projects that are not yet ready to migrate to Tailwind v4

Under The Hood

Architecture - The plugin is a single-purpose Tailwind plugin (src/index.ts, ~85 lines) that registers the @container utility class and a matchVariant-based set of @{size} variants using Tailwind’s plugin API, generating the underlying CSS @container at-rules and container-name scoping for the named-container feature. Tech Stack - TypeScript, built against the Tailwind CSS v3 plugin API (tailwindcss as a peer dependency), with Jest for testing (jest/ config, tests/index.test.ts). Code Quality - The test suite (~250 lines) exercises the generated CSS output for the base container class, each named size variant, named containers, and arbitrary-value variants, giving reasonable confidence the class-to-CSS mapping stays correct across Tailwind versions; however, the project has seen low commit activity since Tailwind v4 shipped native container-query support. API Design - The plugin deliberately reuses Tailwind’s established variant syntax (@lg: mirrors lg:) so there is effectively zero new API surface for developers already familiar with Tailwind’s responsive design system to learn.

Used by 23 apps in this directory

TypeScript
56%
Other

agenta

AI Development · Developer Tools · Devops

4,788

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript 56%
Python 39%
Updated 5 days ago
Rust
67%
MIT

Bun

Developer Tools

96,068

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
64
Dependency
Built with
Rust 67%
C++ 19%
TypeScript 10%
Updated 5 days ago
Go
72%
Other

Convoy

Developer Tools · Devops

2,876

Convoy is an open-source, cloud-native webhooks gateway that ingests events over HTTP or straight from Kafka, SQS, Google Pub/Sub, and RabbitMQ, then reliably delivers them to subscriber endpoints with signed payloads, automatic retries, circuit breaking, and JavaScript-based transformations.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
Go 72%
TypeScript 15%
HTML 12%
Updated 5 days ago
TypeScript
92%
AGPL 3.0

Documenso

Digital Signiture

15,224

Self-hosted, open-source DocuSign alternative with legally binding PDF signatures, multi-party workflows, and a full REST and tRPC API.

View details
93
Repo Health
79
Technical
68
Dependency
Built with
TypeScript 92%
Updated 4 days ago
TypeScript
100%
Other

Dub

Analytics · Marketing

24,835

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
62
Dependency
Built with
TypeScript 100%
Updated 4 days ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
66%
Other

Morphik

AI Development · Databases · Search

3,716

Morphik is an AI-native ingestion and retrieval engine that lets developers store, search, and reason over visually rich documents — scanned PDFs, manuals, slides, and video — without duct-taping together OCR, an embedding model, and a vector database.

View details
60
Repo Health
71
Technical
67
Dependency
Built with
Python 66%
TypeScript 23%
Updated 1 weeks ago
TypeScript
96%

Open Scouts

AI Agents · Automation

1,372

Create automated AI scouts that continuously search the web and send email alerts when they find what you're looking for.

View details
34
Repo Health
65
Technical
69
Dependency
Built with
TypeScript 96%
Updated 4 months ago
TypeScript
82%
AGPL 3.0

OpenStatus

Devops · Monitoring

9,143

Open-source status pages and uptime monitoring with global synthetic checks, monitoring-as-code, and AI agent integration via MCP.

View details
77
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 82%
MDX 15%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers