Use with Next.js - Flowbite React
Copy the starter or follow the steps below to get started with Flowbite React in Next.js.
#
Flowbite Next.js Starter#
Add Flowbite React to your Next.js project- Install dependencies:
npm install --save autoprefixer postcss tailwindcss flowbite flowbite-react
- Create
postcss.config.js
:
module.exports = {
plugins: {
autoprefixer: {},
tailwindcss: {},
},
};
- Create
tailwind.config.js
:
/** @type {import('@types/tailwindcss/tailwind-config').TailwindConfig} */
module.exports = {
// note: if using Next.js 12 or earlier, you'll want to include ./pages/ instead of ./app/
content: ['./app/**/*.{ts,tsx}', './node_modules/flowbite-react/lib/**/*.js'],
plugins: [require('flowbite/plugin')],
// ...
};
- And replace the contents of
styles/globals.css
by:
@tailwind base;
@tailwind components;
@tailwind utilities;
- Start using
flowbite-react
!
'use client';
import { Alert } from 'flowbite-react';
export default function MyPage() {
return <Alert color="info">Alert!</Alert>;
}