{"id":13480246,"url":"https://github.com/dgknca/tailwindcss-container-query","last_synced_at":"2026-01-24T04:56:02.301Z","repository":{"id":39602410,"uuid":"436004202","full_name":"dgknca/tailwindcss-container-query","owner":"dgknca","description":"A plugin that provides CSS Container Queries for tailwindcss.","archived":false,"fork":false,"pushed_at":"2022-06-24T16:24:11.000Z","size":193,"stargazers_count":86,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T15:01:55.155Z","etag":null,"topics":["tailwindcss","tailwindcss-plugin"],"latest_commit_sha":null,"homepage":"https://dgknca.github.io/tailwindcss-container-query/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgknca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-07T19:35:30.000Z","updated_at":"2025-03-03T22:51:12.000Z","dependencies_parsed_at":"2022-08-09T15:09:04.017Z","dependency_job_id":null,"html_url":"https://github.com/dgknca/tailwindcss-container-query","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgknca%2Ftailwindcss-container-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgknca%2Ftailwindcss-container-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgknca%2Ftailwindcss-container-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgknca%2Ftailwindcss-container-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgknca","download_url":"https://codeload.github.com/dgknca/tailwindcss-container-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245826826,"owners_count":20678863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tailwindcss","tailwindcss-plugin"],"created_at":"2024-07-31T17:00:36.268Z","updated_at":"2026-01-24T04:56:02.255Z","avatar_url":"https://github.com/dgknca.png","language":"JavaScript","readme":"# tailwindcss-container-query\n\nA plugin that provides CSS Container Queries.\n\n## BEFORE STARTING\n\nThis plugin relies on [container-query-polyfill](https://github.com/GoogleChromeLabs/container-query-polyfill). **You must add it to make this plugin work.** We have to rely on polyfills until all browsers have implemented them. [see the support table](https://caniuse.com/css-container-queries)\n\n## Installation\n\nInstall the plugin from npm:\n\n```sh\n# Using npm\nnpm install tailwindcss-container-query\n\n# Using Yarn\nyarn add tailwindcss-container-query\n```\n\nThen add the plugin to your `tailwind.config.js` file:\n\n```js\n// tailwind.config.js\nmodule.exports = {\n  theme: {\n    // ...\n  },\n  plugins: [\n    require('tailwindcss-container-query'),\n    // ...\n  ],\n}\n```\n\n## Usage\n\nContainer Queries up to 10 are generated by default:\n\n| Class | Query |\n| --- | --- |\n| `cq-w-4` | `@container (min-width: 64px)` |\n| `cq-w-6` | `@container (min-width: 96px)` |\n| `cq-w-9` | `@container (min-width: 144px)` |\n| `cq-w-16` | `@container (min-width: 256px)` |\n| `cq-w-22` | `@container (min-width: 352px)` |\n| `cq-h-4` | `@container (min-height: 64px)` |\n| `cq-h-6` | `@container (min-height: 96px)` |\n| `cq-h-9` | `@container (min-height: 144px)` |\n| `cq-h-16` | `@container (min-height: 256px)` |\n| `cq-h-22` | `@container (min-height: 352px)` |\n\nUtilities:\n\n| Class | Property |\n| --- | --- |\n| `container-type-size` | `container-type: size` |\n| `container-type-inline-size` | `container-type: inline-size` |\n| `container-type-block-size` | `container-type: block-size` |\n| `container-type-style` | `container-type: style` |\n| `container-type-state` | `container-type: state` |\n\nThere are no any `container-name` utilities by default. You should define your own utilities in `tailwind.config.js`.\n\n## Example Usage\n\n```html\n\u003cdiv class=\"cq-w-6:bg-yellow-400\"\u003e\u003c/div\u003e\n```\n\nOutput:\n\n```css\n@container (min-width: 96px) {\n  .cq-w-6\\:bg-yellow-400 {\n    --tw-bg-opacity: 1;\n    background-color: rgb(96 165 250 / var(--tw-bg-opacity));\n  }\n}\n```\n\n#### You can use arbitrary variants too. (You should be using v3.1.0 or higher!)\n\n```html\n\u003cdiv class=\"cq-w-[238px]:bg-yellow-400\"\u003e\u003c/div\u003e\n```\n\nOutput:\n\n```css\n@container (min-width: 238px) {\n  .cq-w-\\[238px\\]\\:bg-yellow-400 {\n    --tw-bg-opacity: 1;\n    background-color: rgb(96 165 250 / var(--tw-bg-opacity));\n  }\n}\n```\n\n## Using Container Names\n\n```html\n\u003cdiv class=\"cq-w-sb-6:bg-yellow-400\"\u003e\u003c/div\u003e\n```\n\n```js\n// tailwind.config.js\nmodule.exports = {\n  theme: {\n    containerName: {\n      sb: 'sidebar'\n    },\n    // ...\n  }\n}\n```\n\nOutput:\n\n```css\n@container sidebar (min-width: 96px) {\n  .cq-w-sb-6\\:bg-yellow-400 {\n    --tw-bg-opacity: 1;\n    background-color: rgb(96 165 250 / var(--tw-bg-opacity));\n  }\n}\n```\n\n## Configuration\n\nYou can configure which values and variants are generated by this plugin under the `containerQuery`, `containerType` and `containerName` keys in your `tailwind.config.js` file:\n\n```js\n// tailwind.config.js\nmodule.exports = {\n  theme: {\n    // P.S. Container Query thresholds can only be specified using pixels because of the polyfill I recommended.\n    containerQuery: {\n      xs: '120px',\n      sm: '240px',\n      md: '360px',\n    },\n    containerType: {\n      size: 'size',\n    }\n  }\n}\n```\n\n## [Demo Page](https://dgknca.github.io/tailwindcss-container-query/)","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgknca%2Ftailwindcss-container-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgknca%2Ftailwindcss-container-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgknca%2Ftailwindcss-container-query/lists"}