EDIT 5/19/2021: Updated post to reflect the new per-app custom CSS feature, which makes all of this a lot easier
EDIT 5/3/2020: Updated post to reflect the recent addition of the color picker for text components (which rendered my example obsolete).
Often, people will ask me questions along the lines of:
How can I change the color of this text?
Or the background color of this container?
Can I hide this part of this component?
The answer? Custom CSS!
There are 2 ways to add custom CSS to Retool apps.
Globally for all Retool apps — you can add any CSS you'd like to the "Preloaded CSS" area of the /settings/advanced page. Note: you currently need admin permissions to add this.
Locally to 1 Retool app — click the three dots, then scripts and styles. CSS will affect all components in the app.
In either case, you'll want to inspect elements using the Chrome Inspector to find the right classes to target. We prefix components with _retool- so if you have a components named "textinput1" it will have a class of _retool-textinput1 that you can target.
Here's an example of adding CSS to change the color of the icon in a text input component:
Thanks. I'm probably missing something obvious but not having any luck. Followed your example and doesn't seem to find the class because the color is not red:
Hey @dgarvin57 sorry this post is a bit out of date. We've since launched a native color picker for text components so this is overriding your CSS (the color picker is scoped more specifically than the CSS I initially wrote).
I'll update my post tonight with a better & update-to-date example
It should be noted that if you copy the code exactly as it’s written then it will not work. Just wanted to point this out for any web newbies or someone like myself who could not for the life of me figure out why this wouldn’t work for 30 minutes, but the last style tag needs to be a closing tag </style>. Full code example is:
Thank you for sharing. I am loving retool, and the support team that is behind it. It seems really powerful AND doesn’t have too steep of a learning curve. Nevertheless, I need a bit of help figuring out this:
I can’t seem to find a way to HIDE the entire heading of a table.
I am attempting to hide the header because I am using the table in a context that renders the header redundant and a waste of space.
So, in my attempt at following your instructions I ended up with this code:
@alex, thanks! Worked perfectly, but I have another question, presumably related…
Is there a way to style components within a listview so that each component
touches on the left / right / top / and bottom border; and
I can control the border / shadow of the component
I am doing trying to do this in order to make the ListView appear like a table (albeit on steroids).
To begin, I tried setting the CSS of the ReactTable you helped me style with the CSS code shown below… the MARGIN property works, but I can’t get the rounded border to go away.
Also, I am just realizing that Retools GUI is responsible for the spacing that exists between the components within the listview. (I am assuming the GUI sets the XY coordinates of each component on the grid, and by default, will not let them touch each other)… Is there some way to get the components closer to each other?
Hi @sseira thanks for your comment! We actually added a proper CSS stylesheet area in the app editor recently. You can access this from the Scripts and styles option in the ... menu of the Retool app editor. Here's the product announcement in our release notes.
Hi, all. Trying to change the CSS of a Text component (not input text) and not working. Specifically I am trying to override the font size. I can successfully override the
Hi all! I think I got this to work It took a bit of trying. Looks like we have to specify the <p> tag inside the component for the font-size changes to work!
#retool-widget-text1 p
Here was my process for anyone curious:
First, I grabbed the selector (using the browser inspector > copy > copy selector) of the main text component. No luck.