Tailwind CSS Setup
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.
Prerequisites
- React 18+
- TypeScript 5+
- Node.js 16+
Quick Setup (New Tailwind Installation)
If you don’t have Tailwind CSS in your project yet, follow these steps:
1. Install Dependencies
2. Configure PostCSS
Create a postcss.config.mjs
file in your project root:
3. Create Tailwind Config
Create a tailwind.config.ts
file using the following Tailwind plugin:
4. Import Tailwind Styles
Create or update your global CSS file to include Tailwind:
Tailwind v4 (Recommended)
Tailwind v3
Existing Tailwind Installation
If you already have Tailwind CSS configured in your project:
1. Update Your Tailwind Config
Wrap your existing configuration with Account Kit’s plugin:
2. Update CSS Import (Tailwind v4 only)
If using Tailwind v4, update your CSS to reference the config:
Framework-Specific Setup
Next.js
For Next.js projects, make sure to import your global CSS in app/layout.tsx
:
Create React App
Import your global CSS in src/index.js
or src/index.tsx
:
Vite
Import your global CSS in src/main.tsx
:
Testing Your Setup
To verify Tailwind is working correctly with Account Kit:
- Start your development server
- Add a simple Smart Wallets UI component to test:
- The button should render with pre-built styling
Troubleshooting
Styles Not Loading
If UI components appear unstyled:
- Verify CSS import: Make sure you’re importing your global CSS file
- Check config path: Ensure the
@config
path 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
Build Errors
If you encounter build errors:
- TypeScript config: Ensure your
tsconfig.json
includes 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
Dark Mode Issues
If dark mode isn’t working correctly:
- Color sets: Ensure you’re using
createColorSet
for 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
Next Steps
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
Need Help?
If you’re still having issues with Tailwind setup:
- Check the interactive demo for working configuration examples
- Review the troubleshooting guide
- Join our Discord community for support