百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

next-view-transitions

> 前端框架
开源

在 Next.js 应用程序路由器中使用 CSS 视图过渡 API。

2.4K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

在 Next.js 应用程序路由器中使用 CSS 视图过渡 API。

next-view-transitions

Use View Transitions API in Next.js App Router.

Demo.

Disclaimer

This library is aimed at basic use cases of View Transitions and Next.js App Router. With more complex applications and use cases like concurrent rendering, Suspense and streaming, new primitives and APIs still need to be developed into the core of React and Next.js in the future (more).

Installation

Use your favorite package manager to install the next-view-transitions package. For example:

bash
pnpm install next-view-transitions

Usage

Wrap your content with the <ViewTransitions> component inside the layout file:

javascript
import { ViewTransitions } from 'next-view-transitions'

export default function Layout({ children }) {
  return (
    <ViewTransitions>
      <html lang='en'>
        <body>
          {children}
        </body>
      </html>
    </ViewTransitions>
  )
}

Then, use the <Link> component for links that need to trigger a view transition:

javascript
import { Link } from 'next-view-transitions'

export default function Component() {
  return (
    

  )
}

Or use the useTransitionRouter hook for programmatic navigation:

javascript
import { useTransitionRouter } from 'next-view-transitions'

export default function Component() {
  const router = useTransitionRouter()

  return (
    

  )
}

That's it!

License

MIT.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptapp-routernextjsview-transitions

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架