Use with Remix - Flowbite React
Learn how to install Flowbite React for your Remix project to leverage quicker page loads with a full-stack web framework built by Shopify
Create project#
Run the following command to create a new Remix project:
npx create-remix@latest
Setup Tailwind CSS#
- Install
tailwindcssand its peer dependencies:
npm i -D tailwindcss
- Generate
tailwind.config.tsfile:
npx tailwindcss init --ts
- Add the paths to all of your template files in your
tailwind.config.tsfile:
import type { Config } from 'tailwindcss';
export default {
content: ['./app/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {},
},
plugins: [],
} satisfies Config;
- Create a
./app/tailwind.cssfile and add the@tailwinddirectives for each of Tailwind's layers:
@tailwind base;
@tailwind components;
@tailwind utilities;
- Import the newly-created
./app/tailwind.cssfile in your./app/root.tsxfile:
import stylesheet from '~/tailwind.css';
export const links: LinksFunction = () => [
// ...
{ rel: 'stylesheet', href: stylesheet },
];
Install Flowbite React#
- Run the following command to install
flowbite-react:
npm i flowbite-react
- Add the Flowbite plugin to
tailwind.config.tsand include content fromflowbite-react:
import flowbite from 'flowbite/plugin';
import type { Config } from 'tailwindcss';
export default {
content: [
// ...
'node_modules/flowbite-react/lib/esm/**/*.js',
],
plugins: [
// ...
flowbite,
],
} satisfies Config;
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 default function Index() {
return <Button>Click me</Button>;
}