{"id":21467058,"url":"https://github.com/ekafyi/tailwindcss-view-transitions","last_synced_at":"2025-07-15T05:31:07.857Z","repository":{"id":193869648,"uuid":"689018143","full_name":"ekafyi/tailwindcss-view-transitions","owner":"ekafyi","description":"TailwindCSS plugin for customizing styles for the View Transitions Web API","archived":false,"fork":false,"pushed_at":"2023-09-11T15:07:18.000Z","size":55,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T22:03:06.667Z","etag":null,"topics":["tailwindcss","tailwindcss-plugin","view-transitions","view-transitions-api"],"latest_commit_sha":null,"homepage":"","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/ekafyi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-08T15:47:48.000Z","updated_at":"2025-05-21T12:52:20.000Z","dependencies_parsed_at":"2023-09-10T14:53:31.415Z","dependency_job_id":null,"html_url":"https://github.com/ekafyi/tailwindcss-view-transitions","commit_stats":null,"previous_names":["ekafyi/tailwindcss-view-transitions"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ekafyi/tailwindcss-view-transitions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekafyi%2Ftailwindcss-view-transitions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekafyi%2Ftailwindcss-view-transitions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekafyi%2Ftailwindcss-view-transitions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekafyi%2Ftailwindcss-view-transitions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekafyi","download_url":"https://codeload.github.com/ekafyi/tailwindcss-view-transitions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekafyi%2Ftailwindcss-view-transitions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265281039,"owners_count":23739859,"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","view-transitions","view-transitions-api"],"created_at":"2024-11-23T08:16:27.620Z","updated_at":"2025-07-15T05:31:07.530Z","avatar_url":"https://github.com/ekafyi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tailwindcss-view-transitions\n\n[![NPM package version](https://img.shields.io/npm/v/tailwindcss-view-transitions)](https://www.npmjs.com/package/tailwindcss-view-transitions)\n\nA plugin for customizing styles for the [View Transitions Web API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API).\n\n## Installation\n\n```sh\nnpm install -D tailwindcss-view-transitions\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-view-transitions\"),\n    // ...\n  ],\n}\n```\n\n## Usage\n\nUse the `vt-name-[ANY_STRING]` utility class to [create a separate view transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API#different_transitions_for_different_elements) on specific elements.\n\n```html\n\u003cdiv class=\"vt-name-[main-content]\"\u003e\n\u003c/div\u003e\n```\n\nUse `vt-name-none` to disable a view transition. Can be used with any Tailwind variant, such as `md:*`.\n\n```html\n\u003cdiv class=\"vt-name-[main-content] md:vt-name-none\"\u003e\n\u003c/div\u003e\n\n\u003cdiv class=\"vt-name-[main-content] motion-reduce:vt-name-none\"\u003e\n\u003c/div\u003e\n```\n\nThe name can be any string except `root` (❌ `vt-name-[root]`), which is reserved for the default top-level view transition.\n\n| Class  | CSS properties |\n| ---  | --- |\n| `vt-name-[foo]` |  `view-transition-name: foo;` |\n| `vt-name-[main-content]` |  `view-transition-name: main-content;` |\n| `vt-name-none` |  `view-transition-name: none;` |\n\n### Styling with CSS\n\nStyle the view transition pseudo-elements from your global CSS file.\n\n```css\n/* input.css */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n::view-transition-old(root),\n::view-transition-new(root) {\n  animation: none;\n}\n\n::view-transition-old(main-content) {\n  /* Add custom animation or style here */\n  /* animation: ... */\n}\n\n::view-transition-new(main-content) {\n  /* Add custom animation or style here */\n  /* animation: ... */\n}\n```\n\n### Configuration\n\nAlternatively, you can define styles from plugin configuration in your `tailwind.config.js` file.\n\n```js\n// tailwind.config.js\nmodule.exports = {\n  plugins: [\n    require(\"tailwindcss-view-transitions\")({\n      disableAllReduceMotion: false,\n      styles: {\n        // ...\n      },\n    }),\n    // ... other plugins\n  ],\n}\n```\n\n## Options\n\nThe plugin config accepts an options object as argument which contains these properties. All are optional.\n\n### `disableAllReduceMotion`\n\n- Type: `boolean`\n- Default: `false`\n\nDisables _all_ view transitions animation if user has set preference for reduced motion. (Note: Consider [this point](https://developer.chrome.com/docs/web-platform/view-transitions/#:~:text=a%20preference%20for%20%27reduced%20motion%27%20doesn%27t%20mean%20the%20user%20wants%20no%20motion) before disabling animations completely.)\n\nIf `true`, it applies this code globally:\n\n```css\n@media (prefers-reduced-motion) {\n  ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*) {\n    animation: none !important;\n  }\n}\n```\n\n### `styles`\n\n- Type: `Record\u003cstring, CSSRuleObject \u0026 { old?: CSSRuleObject; new?: CSSRuleObject }\u003e`\n- Default: `{}`\n\nDefines CSS styles for the view transition pseudo-elements.\n\nThe styles object may contain any number of properties. \n\n- The **key** is the view transition name (`root` or any string value assigned [here](#usage))\n- The **value** is one or more of these:\n  - a [CSS rule object](https://github.com/tailwindlabs/tailwindcss/blob/9faf10958b880067cacdd0ef3c4bf9e64172ed91/types/config.d.ts#L15), which will be applied to both outgoing (`::view-transition-old(VT_NAME)`) and incoming (`::view-transition-new(VT_NAME)`) pseudo-elements\n  - a propery `old` containing a CSS rule object, which will be applied only to `::view-transition-old(VT_NAME)`\n  - a propery `new` containing a CSS rule object, which will be applied only to `::view-transition-new(VT_NAME)`\n\n| styles config  | Generated CSS |\n| ---  | --- |\n| \u003cpre\u003e{ \u003cbr/\u003e  root: { animation: \"none\" },\u003cbr/\u003e}\u003c/pre\u003e | \u003cpre\u003e::view-transition-old(root),\u003cbr/\u003e::view-transition-new(root) {\u003cbr/\u003e  animation: none;\u003cbr/\u003e}\u003c/pre\u003e |\n| \u003cpre\u003e{ \u003cbr/\u003e  root: { \u003cbr/\u003e    old: { animationDuration: \"1s\" },\u003cbr/\u003e    new: { animationDuration: \"3s\" },\u003cbr/\u003e  },\u003cbr/\u003e}\u003c/pre\u003e | \u003cpre\u003e::view-transition-old(root) {\u003cbr/\u003e  animation-duration: 1s;\u003cbr/\u003e}\u003cbr/\u003e::view-transition-new(root) {\u003cbr/\u003e  animation-duration: 3s;\u003cbr/\u003e}\u003c/pre\u003e |\n| \u003cpre\u003e{ \u003cbr/\u003e  root: { animation: \"none\" },\u003cbr/\u003e  \"main-content\": { \u003cbr/\u003e    old: { animationDuration: \"1s\" },\u003cbr/\u003e    new: { animationDuration: \"3s\" },\u003cbr/\u003e  },\u003cbr/\u003e}\u003c/pre\u003e | \u003cpre\u003e::view-transition-old(root),\u003cbr/\u003e::view-transition-new(root) {\u003cbr/\u003e  animation: none;\u003cbr/\u003e}\u003cbr/\u003e\u003cbr/\u003e::view-transition-old(main-content) {\u003cbr/\u003e  animation-duration: 1s;\u003cbr/\u003e}\u003cbr/\u003e::view-transition-new(main-content) {\u003cbr/\u003e  animation-duration: 3s;\u003cbr/\u003e}\u003c/pre\u003e |\n\n⚠️ If applying custom CSS animation, you need to define `@keyframes` separately in your CSS file or through [Tailwind theme configuration](https://tailwindcss.com/docs/animation#customizing-your-theme), or alternatively use an existing `@keyframes` animation.\n\nDetailed examples: https://github.com/ekafyi/tailwindcss-view-transitions/blob/main/docs/examples.md\n\n## When not to use?\n\nYou may not need this plugin if:\n\n* You don’t need to customize the [default browser transition styles](https://developer.chrome.com/docs/web-platform/view-transitions/#default-style-and-transition-reference)\n* You do styling outside of Tailwind configuration\n* You exclusively use a (meta)framework that has its own API for conveniently styling view transitions, such as [Astro](https://docs.astro.build/en/guides/view-transitions/)\n\nAs an unofficial plugin, it will be deprecated when/if Tailwind adds an official plugin for styling view transitions.\n\n## Bugs \u0026 feature requests\n\nWhile I'm not actively accepting feature requests, I outlined future plans in the [Discussions](https://github.com/ekafyi/tailwindcss-view-transitions/discussions).\n\nFound a bug? Feel free to [open an issue](https://github.com/ekafyi/tailwindcss-view-transitions/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekafyi%2Ftailwindcss-view-transitions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekafyi%2Ftailwindcss-view-transitions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekafyi%2Ftailwindcss-view-transitions/lists"}