A simple React component to embed Live2D models (via live2d-widget) in Next.js projects.
- 🧠 Auto-load Live2D Widget
- ⚙️ Zero-config usage with App Router
- 🎒 Comes with built-in model (
histoire) - ✅ SSR-safe using
dynamic(() => import(...), { ssr: false })
npm install next-live2d🧩 Usage in Next.js (app/layout.tsx)
'use client'
import { Live2DWidget } from 'next-live2d' {/* Import tại đây */}
import { ReactNode } from 'react'
import './globals.css'
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<main>{children}</main>
<Live2DWidget modelName="mai" /> {/* Bạn có thể đổi model khác tại đây */}
</body>
</html>
)
}Since v1.4.0, you can customize the widget with:
className: Tailwind or custom CSS classes
style: Inline React.CSSProperties object
<Live2DWidget
modelName="senko"
className="bottom-0 right-0 fixed z-50 opacity-80"
style={{ width: 200, height: 300 }}
/>| Prop | Type | Required | Mô tả |
|---|---|---|---|
modelName |
string |
✅ | Name of the model folder (must include model.json) |
className |
string |
❌ | Custom CSS or Tailwind classes applied to the widget container (ví dụ: fixed bottom-0) |
style |
React.CSSProperties |
❌ | Inline styles (e.g., width, height, position) |
The Live2D widget is rendered into a #live2d-widget DOM element, positioned as fixed by default.
If you pass className or style, they will override the default style.
By default, the widget looks for:
Trần Hữu Đang Website: https://dangth.dev
📝 License MIT





































