How to use Custom CSS in Retool Apps

There are 2 ways to add custom CSS to Retool apps.

  1. Globally for all Retool apps — you can add any CSS you'd like to the "Preloaded CSS" area of the org settings -> advanced page (admin only)
  2. Locally to a single Retool app —
    On newer versions: click the cog wheel settings icon (left panel) -> Custom CSS
    On older versions: click the three dots (top-right menu), then scripts and styles. CSS will affect all components in the app.

Please note, we strongly recommend using Retool's built-in style and theme options whenever possible. Class names and DOM structure may change as new features are added that could break custom CSS.

Modules do not currently support custom CSS.

Why/When do we need custom CSS?

When something in the retool UI isn’t quite how you want it
E.g

  • To set CSS properties for components which aren’t natively supported in Retool
  • To move a modal’s position on the page
  • To change a table’s title height

How does adding CSS work?

The short answer: Find the class name for the element you want to override, add your css with .CLASSNAME in the Custom CSS settings section (directions of where to find this can be found at the top of this guide)

How to easily find the class name for the element?

Enter some unique text inside your component or as the label, then in your dev tools, search for this text, it jumps straight to the right section of the elements tab.


If you're struggling to find the correct class name for the element you want to edit, you can:

Right click on the text you want to add CSS to -> Copy -> Copy selector

This will copy the path to the element you want to edit, and is super easy to avoid having to manually find the correct class. This is especially useful for <p> and <span> tags which don't have a class name assigned.

You can shorten this to:

#retool-widget-textInput1 span {
  font-size:41px; !important
}

and it will still work.


Another way to easily navigate between/find class names is to use the left and right arrows below the element window pictured below. This is useful for when you can't easily enter content inside a component to search for, but want to find the component's given name. (credit: @bobthebear )



Which element should I pick? There’s loads!
Which element we want depends on what you want to change. In this case, I want to set the background behind the “Label” as it can’t be edited via the native styles section

To find the correct class, I’d hover over the elements in the right panel, until the background behind the label lights up, it usually mentions the component name in the format _retool-COMPONENTNAME:

Be aware (I fell for this also), some of the shorter classes are re-used on other elements, note how changing the width of the label also affects the table below it.

The class above it does not highlight the background, so it wouldn’t work (it’s the element for the editor box.


Please note, depending on the class you chose, the class name may be different in the preview VS the editor, so make sure to check in preview mode and add the class from preview mode if needs be.


How do I actually add my CSS?

Enter your CSS code in the Custom CSS settings section (directions of where to find this can be found at the top of this guide)

Use your class name like you usually would in CSS e.g

.classname{

background:red;  !important

}

Sometimes you need to override the style with the !important flag

Uh oh, my label is now hard to read! Since this is editable natively in Retool, it’s best to update it there. But for educational purposes, here’s how we could make changes to a label’s other CSS properties. In this case, the span which contains the text does not have a class. We instead want to reference the div containing the label.

Note, if a class name has a space in it, like here:

Screenshot 2023-02-09 at 16.25.56

We need to replace the space with a full stop (period). Also, in this case, since we want to edit the span’s class, we reference span on the end.

There we have it, marvel at the beauty of your creation!

12 Likes
CSS for modal button
Can you change the color of some column headers?
Increase Font Size of the selected items in multiselect component using css
Visual treatment of icon in table
Wizard run script on "next"
Move toolbar button custom from table component
Progress bar colors in new table
Multiselect Listbox Clear button barely visible
How to change the background color?
How to hide Header component in Retool Embedded
Change Size of Text in Statistic Component
checkboxTree strikethrough text on check
Transparent background on my icons are grey
Opening message in chatbox using 'empty state'
Hide Action Buttons for New Row
How to change the tabs component font size
How to open a modal component in full screen?
Auto-capitalize text in Text Input
Mysterious floating download icon
How do I prevent the app from dimming/flickering while queries are running?
Install npm libraries
Change colors for each button in button group
Bug in Filter Native to Legacy Table
CSS Not Applying to Container
Change the font text
On Select Table Text Bold (and when updated row, text color lighter
How to show images with fix height and width in table
Close modal with js and remove the done button?
Styling reordable list
Extra Spacing in Timeline
Clickable Image Grid
Retool Table - input text hidden when adding first new row
Retool Table Cell Padding
Issue with Auto Height in New ListView Component Not Expanding Fully
"Read Only" for Rating / Stars Component
Dynamic Summary Row
Change the background for a row that is being hovered over
Ability to not show loading state on element such as text
Let retool AI send first message in chat component
Changing CSS does not impact my space margins for steps
ListBox wrap behaviour for line items on mobile
Fixed App Page Width but Centered, with Sidebar?
Calendar: Keep the viewed month of two calendars in sync
Update Navigation component background color
Moving Horizontal Bar Position
Is it possible to add custom header to 'Insert a new row'?
Table Footer Color
Custom CSS classes?
How to make ratings read only
Customizing json explorer
Conditionally set table row text color with currentRow
Onclick button set a css selector
Changing space between steps in Steps Widget
How to set gradient background color in container?