Skip to main content
RapidDev - Software Development Agency
retool-tutorial

How to Apply Custom CSS Styles in Retool

To apply custom CSS in Retool, open App Settings → Custom CSS for per-app styles, or Settings → Preloaded CSS for global styles. Target components using ._retool-componentName selectors. Nearly all overrides require !important because Retool's component library uses high-specificity inline styles. Add custom class names in the Inspector's Advanced → CSS Class Name field to scope your rules.

What you'll learn

  • Where to add per-app CSS vs global Preloaded CSS in Retool settings
  • How to target Retool components using ._retool-componentName CSS selectors
  • Why !important is required for most Retool CSS overrides
  • How to assign CSS class names to components via the Inspector
  • How to scope custom styles to avoid cross-component bleed
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate7 min read15-20 minRetool Cloud and Self-hostedLast updated March 2026RapidDev Engineering Team
TL;DR

To apply custom CSS in Retool, open App Settings → Custom CSS for per-app styles, or Settings → Preloaded CSS for global styles. Target components using ._retool-componentName selectors. Nearly all overrides require !important because Retool's component library uses high-specificity inline styles. Add custom class names in the Inspector's Advanced → CSS Class Name field to scope your rules.

Quick facts about this guide
FactValue
ToolRetool
DifficultyIntermediate
Time required15-20 min
CompatibilityRetool Cloud and Self-hosted
Last updatedMarch 2026

Custom CSS in Retool: Per-App and Global Approaches

Retool renders components using its own component library, which applies inline and high-specificity styles. Overriding these requires understanding where to put your CSS and how to write selectors strong enough to win specificity battles.

Retool provides two injection points: per-app Custom CSS (App Settings → Appearance → Custom CSS) which only affects that app, and global Preloaded CSS (Settings → Preloaded CSS/JS) which applies across all apps in your organization. For most branding work, you'll use per-app CSS; for design system standards, use global Preloaded CSS.

This tutorial walks through targeting components, understanding the ._retool selector pattern, using the CSS Class Name Inspector field, and applying the !important flag correctly to avoid style conflicts.

Prerequisites

  • Retool app with at least one component (Button, Text, Table, etc.)
  • Editor or Admin access to the Retool app
  • Basic familiarity with CSS selectors and properties
  • Access to browser DevTools for inspecting element class names

Step-by-step guide

1

Open the App Settings panel

In the Retool editor, click the gear icon in the top-left toolbar (or press Cmd+, on macOS) to open App Settings. Navigate to the Appearance section. You will see a Custom CSS text area. This CSS applies only to this app and overrides Retool's default component styles for end users when they view the published app.

Expected result: App Settings panel is open and you can see the Custom CSS text area under Appearance.

2

Inspect a component's CSS class names in DevTools

Before writing CSS rules, you need to know the actual class names Retool generates. Open your app in preview mode (or use the editor preview), right-click any component, and choose Inspect Element. Look for class names beginning with _retool- (e.g., ._retool-button, ._retool-text, ._retool-table). These are the selectors you'll target. Note that Retool also generates hashed class names — ignore those and focus on the stable _retool-* prefixed names.

Expected result: You have identified the ._retool-* class name for the component you want to style.

3

Write a CSS rule using !important

In the Custom CSS text area, write your CSS rule targeting the ._retool-* selector you found. Because Retool's component library uses inline styles and high-specificity CSS, nearly all property overrides require the !important flag. Without it, your styles will be silently ignored. Example to change all Button backgrounds to a custom brand color:

typescript
1/* Override primary button background */
2._retool-button-primaryButton {
3 background-color: #7C3AED !important;
4 border-color: #7C3AED !important;
5 border-radius: 8px !important;
6}
7
8/* Override button hover state */
9._retool-button-primaryButton:hover {
10 background-color: #6D28D9 !important;
11 border-color: #6D28D9 !important;
12}

Expected result: Primary buttons in the app now display with the custom brand color instead of Retool's default blue.

4

Assign a CSS Class Name in the Inspector

For component-specific styles without affecting all components of the same type, select a component in the editor. In the Inspector panel, scroll to the Advanced section and find the CSS Class Name field. Enter a custom class name (e.g., hero-button). Then in your Custom CSS, target that class: ```css .hero-button ._retool-button-primaryButton { font-size: 18px !important; padding: 12px 24px !important; } ``` The custom class name is added to the component's wrapper div, so you can use descendant selectors to scope rules to that specific component instance.

Expected result: Only the component with the CSS Class Name applied gets the scoped styles; other components of the same type are unaffected.

5

Add global styles via Preloaded CSS

For styles that should apply across all apps (e.g., a shared design system), navigate to Settings → Preloaded CSS/JS (top-right Settings menu, not per-app settings). Paste CSS into the Preloaded CSS text area. These rules load before any app-level CSS. App-level Custom CSS takes precedence over Preloaded CSS, so you can override globals per-app. Preloaded CSS is ideal for: importing Google Fonts, setting CSS custom properties (design tokens), and organization-wide color overrides.

typescript
1/* Preloaded CSS: org-wide design tokens */
2:root {
3 --brand-primary: #7C3AED;
4 --brand-secondary: #10B981;
5 --font-heading: 'Inter', sans-serif;
6}
7
8/* Import Google Fonts (place at top of Preloaded CSS) */
9@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

Expected result: CSS variables and font imports are available across all apps in your Retool organization.

6

Style the app container and background

To change the overall app background, canvas area, or header bar, target the app-level container classes. The main app content area uses ._retool-app-body. The header uses ._retool-header. You can also target the app wrapper itself with body or html selectors.

typescript
1/* Change app canvas background */
2._retool-app-body {
3 background-color: #F9FAFB !important;
4}
5
6/* Style the app header/toolbar */
7._retool-header {
8 background-color: #1E1B4B !important;
9 border-bottom: 2px solid #7C3AED !important;
10}

Expected result: The app canvas background and header bar reflect your custom colors when the app is previewed.

7

Use CSS media queries for responsive styling

Custom CSS in Retool supports standard CSS media queries. Use these to supplement Retool's built-in mobile layout switching. For components that don't have a separate mobile layout configured, CSS media queries let you adjust font sizes, padding, and visibility for smaller screens.

typescript
1/* Responsive text sizing */
2@media (max-width: 768px) {
3 ._retool-text {
4 font-size: 14px !important;
5 }
6
7 /* Hide non-essential columns on mobile by targeting the column class */
8 .hide-on-mobile {
9 display: none !important;
10 }
11}

Expected result: Components shrink text and optionally hide on screens narrower than 768px.

Complete working example

App Settings → Custom CSS
1/* ============================================
2 Retool Custom CSS Brand Overrides
3 App: [Your App Name]
4 ============================================ */
5
6/* --- Buttons --- */
7._retool-button-primaryButton {
8 background-color: #7C3AED !important;
9 border-color: #7C3AED !important;
10 border-radius: 8px !important;
11 font-weight: 600 !important;
12 letter-spacing: 0.02em !important;
13}
14
15._retool-button-primaryButton:hover {
16 background-color: #6D28D9 !important;
17 border-color: #6D28D9 !important;
18}
19
20/* --- Tables --- */
21._retool-table {
22 border-radius: 8px !important;
23 overflow: hidden !important;
24}
25
26._retool-table thead tr {
27 background-color: #F3F4F6 !important;
28}
29
30._retool-table tbody tr:hover {
31 background-color: #EDE9FE !important;
32}
33
34/* --- Text components --- */
35._retool-text h1,
36._retool-text h2 {
37 font-family: 'Inter', sans-serif !important;
38 font-weight: 700 !important;
39 color: #1E1B4B !important;
40}
41
42/* --- App container --- */
43._retool-app-body {
44 background-color: #F9FAFB !important;
45}
46
47/* --- Scoped hero button (CSS Class Name: hero-button) --- */
48.hero-button ._retool-button-primaryButton {
49 font-size: 18px !important;
50 padding: 12px 28px !important;
51}
52
53/* --- Responsive --- */
54@media (max-width: 768px) {
55 ._retool-text {
56 font-size: 14px !important;
57 }
58 .hide-on-mobile {
59 display: none !important;
60 }
61}

Common mistakes when applying Custom CSS Styles in Retool

Why it's a problem: Forgetting !important and wondering why styles don't apply

How to avoid: Add !important to every property that targets a Retool built-in component. Retool's styled-components library uses class-level specificity that your CSS cannot beat without it.

Why it's a problem: Targeting hashed class names like .sc-bdVyGe that change between Retool versions

How to avoid: Only target stable ._retool-* prefixed class names. Use browser DevTools to identify them — they're always prefixed with _retool.

Why it's a problem: Putting CSS that should be global in per-app Custom CSS, then manually copy-pasting to every app

How to avoid: Use Settings → Preloaded CSS/JS for any styles that need to apply across multiple apps. Per-app CSS only affects one app.

Why it's a problem: Writing overly broad selectors (e.g., button { ... }) that affect browser UI or Retool editor elements

How to avoid: Always prefix with ._retool-* or use a specific custom CSS class name from the Inspector to avoid unintended style bleed into the Retool editor UI.

Best practices

  • Always use !important for property overrides — Retool's component library uses high-specificity styles that will otherwise win
  • Use the CSS Class Name Inspector field to scope styles to specific component instances rather than all components of a type
  • Target ._retool-* stable class names, never hashed/generated class names that change between versions
  • Place organization-wide design tokens (colors, fonts) in Preloaded CSS and use them via CSS custom properties (var(--brand-primary))
  • Test CSS changes in the app preview before saving — invalid CSS silently fails in Retool
  • Keep per-app CSS minimal; if more than 3 apps share the same styles, move them to Preloaded CSS
  • Comment your CSS sections clearly — Retool has no CSS syntax highlighting or linting in the text area

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I'm using Retool and need to apply custom CSS styles to brand my internal tool. My app uses primary buttons, a data table, and text headings. I want to change the button color to #7C3AED, the table header background to #F3F4F6, and the heading font to Inter. Write the CSS rules I need, using the correct ._retool-* class selectors and !important flags. Also explain where in Retool I paste this CSS.

Retool Prompt

Add a Custom CSS block to this Retool app that: (1) changes all primary button backgrounds to #7C3AED with !important, (2) styles the table header row with a light gray background, (3) changes the app canvas background to #F9FAFB. Use ._retool-button-primaryButton, ._retool-table, and ._retool-app-body selectors.

Frequently asked questions

Why is my custom CSS not applying in Retool?

The most common reason is missing !important. Retool's component library uses high-specificity styles, so your override needs !important to win. Also confirm you saved the CSS (Cmd+S), you're using stable ._retool-* class names (not hashed ones), and you're checking the preview view, not just the editor canvas.

Where does Retool's per-app Custom CSS field appear?

In the Retool editor, click the gear icon in the top toolbar to open App Settings. Navigate to the Appearance section — the Custom CSS text area is there. This is separate from the global Preloaded CSS in the main organization Settings menu.

Can I use CSS variables (custom properties) in Retool's custom CSS?

Yes. Define CSS custom properties in Preloaded CSS under :root { --brand-color: #7C3AED; } and reference them in any per-app CSS with var(--brand-color). This is the recommended way to maintain a consistent design token system across apps.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Learning is great. Shipping is faster with help.

Our engineers have built 600+ apps on Retool and the tools around it. If your project needs to be live sooner than your learning curve allows — book a free consultation.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.