Use with Parcel - Flowbite React
Learn how to install Flowbite React for your Parcel project and start developing modern web applications with interactive components
Using the CLI#
Run the following command to scaffold a new Flowbite React project using Parcel:
# npm
npm create flowbite-react@latest -- --template parcel
# yarn
yarn create flowbite-react --template parcel
# pnpm
pnpm create flowbite-react@latest --template parcel
# bun
bun create flowbite-react@latest --template parcel
Manual Installation
Create project#
Follow the steps to create a Parcel project using React and Tailwind CSS.
Setup Parcel#
- Create a directory for your project:
 
mkdir flowbite-react-parcel
- Initialize 
package.jsonfile: 
npm init -y
- Install 
Parcel: 
npm i -D parcel
- Create 
srcdirectory: 
mkdir src
- Create 
src/index.htmlfile: 
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My Parcel App</title>
  </head>
  <body></body>
</html>
- Configure 
package.jsonfile, addsourceand updatescriptswithstartandbuildsteps: 
{
  "name": "flowbite-react-parcel",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "source": "src/index.html",
  "scripts": {
    "start": "parcel",
    "build": "parcel build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
Setup React#
- Install 
React: 
npm i react react-dom
- Create 
src/index.jsfile: 
import { createRoot } from "react-dom/client";
import { App } from "./app";
const container = document.getElementById("app");
const root = createRoot(container);
root.render(<App />);
- Create 
src/app.jsfile: 
export function App() {
  return <h1>Hello world!</h1>;
}
- Update 
src/index.htmlfile: 
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My Parcel App</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="index.js"></script>
  </body>
</html>
Setup Tailwind CSS#
- Install 
tailwindcssand its peer dependencies: 
npm i -D tailwindcss postcss
- Generate 
tailwind.config.jsfile: 
npx tailwindcss init
- Create 
.postcssrcfile and enable the tailwindcss plugin: 
{
  "plugins": {
    "tailwindcss": {}
  }
}
- Add the paths to all of your template files in your 
tailwind.config.jsfile: 
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js,ts,jsx,tsx}"],
  theme: {
    extend: {},
  },
  plugins: [],
};
- Create a 
./src/index.cssfile and add the@tailwinddirectives for each of Tailwind's layers: 
@tailwind base;
@tailwind components;
@tailwind utilities;
- Update 
src/index.htmlto includesrc/index.cssfile in thehead: 
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>My Parcel App</title>
    <link href="./index.css" rel="stylesheet" />
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="index.js"></script>
  </body>
</html>
Install Flowbite React#
- Run the following command to install 
flowbite-react: 
npm i flowbite-react
- Add the Flowbite plugin to 
tailwind.config.jsand include content fromflowbite-react: 
/** @type {import('tailwindcss').Config} */
export default {
  content: [
    // ...
    "node_modules/flowbite-react/lib/esm/**/*.js",
  ],
  plugins: [
    // ...
    require("flowbite/plugin"),
  ],
};
Try it out#
Now that you have successfully installed Flowbite React you can start using the components from the library.
import { Button } from "flowbite-react";
export function App() {
  return <Button>Click me</Button>;
}