To use pre-built UI components for user login Tailwind CSS must be configured in your project. This guide walks you through the complete setup process for both new and existing Tailwind installations.
- React 18+
- TypeScript 5+
- Node.js 16+
If you don't have Tailwind CSS in your project yet, follow these steps:
yarn add -D tailwindcss @tailwindcss/postcss postcssCreate a postcss.config.mjs file in your project root:
export default {
plugins: {
"@tailwindcss/postcss": {},
},
};Create a tailwind.config.ts file using the following Tailwind plugin:
import { withAccountKitUi } from "@account-kit/react/tailwind";
export default withAccountKitUi(
{
// Your existing Tailwind config (if any)
content: [
"./src/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
],
},
{
// Account Kit UI theme customizations (optional)
// See customization guide below for available options
},
);Create or update your global CSS file to include Tailwind:
@import "tailwindcss";
@config '../tailwind.config.ts';If you already have Tailwind CSS configured in your project:
Wrap your existing configuration with Account Kit's plugin:
import { withAccountKitUi } from "@account-kit/react/tailwind";
export default withAccountKitUi(
{
// Your existing Tailwind config - DON'T replace, just wrap!
content: [
"./src/**/*.{js,ts,jsx,tsx,mdx}",
// ... your existing content patterns
],
theme: {
// ... your existing theme customizations
},
plugins: [
// ... your existing plugins
],
},
{
// Account Kit UI theme customizations
},
);If using Tailwind v4, update your CSS to reference the config:
@import "tailwindcss";
@config '../tailwind.config.ts';For Next.js projects, make sure to import your global CSS in app/layout.tsx:
import "./globals.css";
// ... rest of your layoutImport your global CSS in src/index.js or src/index.tsx:
import "./index.css";
// ... rest of your index fileImport your global CSS in src/main.tsx:
import "./index.css";
// ... rest of your main fileTo verify Tailwind is working correctly with Account Kit:
- Start your development server
- Add a simple Smart Wallets UI component to test:
import { useAuthModal } from "@account-kit/react";
export function TestComponent() {
const { openAuthModal } = useAuthModal();
return (
<button className="akui-btn akui-btn-primary" onClick={openAuthModal}>
Test Auth Modal
</button>
);
}- The button should render with pre-built styling
If UI components appear unstyled:
- Verify CSS import: Make sure you're importing your global CSS file
- Check config path: Ensure the
@configpath in your CSS matches your config file location - Restart dev server: Sometimes a restart is needed after config changes
- Verify content paths: Make sure your Tailwind content array includes all component files
If you encounter build errors:
- TypeScript config: Ensure your
tsconfig.jsonincludes the Tailwind config file - PostCSS version: Make sure you're using compatible PostCSS versions
- Import paths: Verify all import paths in your config are correct
If dark mode isn't working correctly:
- Color sets: Ensure you're using
createColorSetfor colors that should change between modes - CSS variables: Check that CSS custom properties are being generated correctly
- Theme detection: Verify your app has proper dark mode detection
After setting up Tailwind CSS:
- Customize your theme with colors and styling
- Set up authentication in your React app
- Use UI components for pre-built authentication flows
- Explore React hooks for custom UI implementations
If you're still having issues with Tailwind setup:
- Review the troubleshooting guide
- Join our Discord community for support