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#

  1. Install dependencies:
npm install --save autoprefixer postcss tailwindcss flowbite flowbite-react
  1. Create postcss.config.js:
module.exports = {
  plugins: {
    autoprefixer: {},
    tailwindcss: {},
  },
};
  1. 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')],
  // ...
};
  1. And replace the contents of styles/globals.css by:
@tailwind base;
@tailwind components;
@tailwind utilities;
  1. Start using flowbite-react!
'use client';

import { Alert } from 'flowbite-react';

export default function MyPage() {
  return <Alert color="info">Alert!</Alert>;
}