CSS & Tailwind Configuration
The Tambo CLI automatically configures your CSS and Tailwind setup based on your project's Tailwind CSS version. This page explains what changes are made and how to configure them manually if needed.
What Gets Configured
When you run Tambo CLI commands (full-send
, add
, update
, upgrade
), the CLI:
- Detects your Tailwind CSS version (v3 or v4)
- Updates your
globals.css
with required CSS variables - Updates your
tailwind.config.ts
(v3 only) with basic configuration - Preserves your existing styles and configuration
Automatic Detection
The CLI automatically detects your Tailwind version from your package.json
and applies the appropriate configuration format. You don't need to specify
which version you're using.
CSS Variables Added
Tambo components require specific CSS variables to function properly. The CLI adds these in the appropriate format for your Tailwind version:
Core Tailwind Variables
These standard Tailwind CSS variables are added with Tambo's default color scheme:
Tambo-Specific Variables
These custom variables control Tambo component layouts and behavior:
Required Variables
The Tambo-specific variables (--panel-left-width
, --panel-right-width
,
--sidebar-width
, --container
, --backdrop
, --muted-backdrop
) are
essential for proper component functionality. Removing these will break
component layouts.
Tailwind CSS v3 Configuration
For Tailwind v3 projects, the CLI uses the @layer base
approach:
Complete globals.css for v3
tailwind.config.ts for v3
Tailwind CSS v4 Configuration
Tailwind v4 uses CSS-first configuration with a different approach:
Complete globals.css for v4
Tailwind v4 Configuration
With Tailwind v4, most configuration is done in CSS using @theme inline
. The
JavaScript config file is not needed.
Manual Configuration
If you need to manually configure these files or the automatic setup doesn't work:
1. Check Your Tailwind Version
2. Copy the Appropriate CSS
Choose the v3 or v4 format based on your version and copy the complete CSS above into your globals.css
file.
3. Update Tailwind Config (v3 only)
For v3, ensure your tailwind.config.ts
includes darkMode: "class"
and the proper content paths.
4. Verify Required Variables
Ensure these Tambo-specific variables are present:
--panel-left-width
--panel-right-width
--sidebar-width
--container
--backdrop
--muted-backdrop
--radius
Merging with Existing Styles
Preserving Custom Styles
If you already have CSS variables defined, you'll want to merge them carefully rather than replacing your entire file. The CLI automatically preserves existing variables, but manual setup requires more care.
If you have existing CSS variables:
- Keep your existing variables that aren't listed in the Tambo configuration
- Add missing Tambo variables from the appropriate version above
- Update conflicting variables if you want to use Tambo's color scheme
- Preserve your custom styling outside of the CSS variables
If you have existing @layer base
blocks:
For Tailwind v3, add the Tambo variables inside your existing @layer base
block rather than creating a duplicate.
Troubleshooting
Components Look Broken
Problem: Components have no styling or look broken
Solution: Check that all CSS variables are present in your globals.css
Dark Mode Not Working
Problem: Dark mode styles not applying
Solution:
- For v3: Ensure
darkMode: "class"
intailwind.config.ts
- For v4: Check
@custom-variant dark
is present - Verify
.dark
class variables are defined
Version Mismatch
Problem: Wrong CSS format for your Tailwind version
Solution:
- Check your Tailwind version with
npm list tailwindcss
- Use v3 format (HSL) for Tailwind 3.x
- Use v4 format (OKLCH) for Tailwind 4.x
Layout Issues
Problem: Panels or sidebars have wrong dimensions
Solution: Ensure Tambo layout variables (--panel-left-width
, etc.) are defined and have appropriate values
Existing Styles Overridden
Problem: Your custom CSS variables got replaced
Solution: The CLI preserves existing variables, but if manually copying, merge with your existing styles rather than replacing them
CLI Behavior
What the CLI Does
- ✅ Preserves existing styles: Your custom CSS is kept
- ✅ Adds only missing variables: Won't override your existing variables
- ✅ Backs up files: Creates
.backup
files before making changes - ✅ Shows diffs: Previews changes before applying them
- ✅ Asks permission: Prompts before modifying existing files
What the CLI Doesn't Do
- ❌ Override existing variables: Your customizations are preserved
- ❌ Change your color scheme: Only adds missing standard variables
- ❌ Modify other CSS: Only touches CSS variable definitions
- ❌ Break existing config: Merges with your existing Tailwind config
Safe Configuration
The CLI is designed to be safe and non-destructive. It preserves your existing configuration and only adds what's needed for Tambo components to work.