Skip to main content

Custom styling (ALPHA)

Alpha feature: invite only

Responsive Widgets are in alpha and available by invitation only on Business and Enterprise plans. Behavior and properties may change. To request access, open a support ticket and name the feature Responsive Widgets (ALPHA).

Every Responsive Widget except Custom has a Custom styling section. Use it to change the colors, border, and corners of one widget without changing the app theme. Most widgets also have a Custom CSS setting in this section. Classic widgets in fixed-layout apps do not have this section.

The section is the last one in the Style tab of the property pane. It starts collapsed when the widget has other style sections. When it is the only style section, it starts open.

Each widget has only the settings that fit it. The settings change one part of the widget, called the styled part. For example, on an Input they change the input field box, and on a Chart they change the outer card, not the chart. See Settings by widget.

How values work​

  • Empty means From theme. Every setting starts empty. An empty setting shows the theme value, and changes when the theme changes.
  • Theme color or custom color. A color setting offers theme color swatches and a color picker. A theme color follows the theme, in light and dark mode. A custom color is fixed. It does not change in dark mode.
  • Some settings take a custom color only. These settings do not offer theme colors: Background on Section and Stats, Border color on Stats, and Text color on Paragraph and Heading.
  • Invalid values are ignored. A value that is not a valid color shows the theme value instead. The property pane shows an error for it.

You can bind the color settings with JavaScript, so an app can pick a color at run time. Write a theme color in code as token:<name>, for example token:accent. Border width, Corners, and Custom CSS cannot be bound.

A custom color can be a hex value (#553de9), rgb(), rgba(), hsl(), hsla(), hsv(), hsva(), a color name, or transparent. URLs, CSS variables, and keywords such as inherit or currentColor are not valid.

Settings​

Accent color string​

Builds the hover, pressed, focus, and text colors of the widget from one color, in light and dark mode. Lists and menus that the widget opens use them too. Empty means the theme accent.

Theme colors: Positive, Negative, Warning, Neutral.

On a widget with its own color setting, such as Button color on a Button, Accent color shows only while that setting is Accent.

Background string​

Sets the background of the styled part.

Theme colors: Accent, Accent, subtle, Neutral, subtle, Surface 1, Surface 2, Surface 3. Each theme background comes with a theme text color that is readable on it.

On Section, Stats, Zone, Card, Modal, and Sheet, Background also takes a gradient. Choose Gradient in the color control to build one:

  • Set the Angle, or pick a preset angle.
  • Add up to 6 stops. A gradient needs at least 2 stops. Each stop has a Color and a Position, in percent.
  • A gradient typed by hand, such as linear-gradient(135deg, #6366f1, #8b5cf6), goes through the JS button. linear-gradient(), radial-gradient(), conic-gradient(), and their repeating- forms are accepted, up to 1024 characters.
  • Solid removes the gradient.

A gradient does not change in dark mode, and it sets no text color. Check that the text is readable in light and dark mode.

On a Modal or Sheet, Background changes the dialog surface. The dimmed overlay behind the dialog does not change.

Text color string​

Sets the text color of the styled part.

Theme colors: Default, Accent, Neutral, Positive, Negative, Warning.

When Text color is empty and Background is set, the widget picks a text color that is readable on the background.

When the text color and the background have a contrast below 4.5:1, the property pane shows a low contrast warning, for example Low contrast: 2.1:1. Text needs at least 4.5:1 against the background. The check needs two solid colors. It skips bindings, gradients, and colors that are partly transparent.

Border color string​

Sets the border color of the styled part. A color with no Border width draws a thin border.

Theme colors: Accent, Neutral, Surface.

On a Divider, this setting is called Line color and sets the color of the line. The Divider's own Thickness setting sets the line width.

Border width string​

Sets the border width of the styled part. Options: From theme (default), None, Thin, Medium, Thick.

Corners string​

Sets the corner radius of the styled part. Options: From theme (default), Sharp, Rounded, Pill. These are the same options as Corners in the app theme.

Custom CSS string​

Adds CSS that applies to this widget only. See Custom CSS.

Settings by widget​

This table lists the settings each widget has, and the part of the widget they change.

  • Yes, or gradient: the setting also takes a gradient.
  • Custom color only: the setting does not offer theme colors.
  • —: the widget does not have the setting.
WidgetAccent colorBackgroundText colorBorderCornersCustom CSSStyled part
AvatarYes————YesControl
BadgeYes————YesControl
ButtonYes————YesControl
CardYesYes, or gradientYesYesYesYesSurface
CarouselYesYesYesYesYesYesSurface
Chart—Yes—YesYesYesOuter card
ChatYes————YesWhole widget
CheckboxYes————YesControl
Checkbox GroupYes————YesControl
Chip GroupYes————YesControl
Code—————YesWhole widget
Code Scanner—Yes—YesYesYesOuter card
ColorPickerYesYesYesYesYesYesInput field box
ComboBoxYesYesYesYesYes—Input field box
Currency InputYesYesYesYesYesYesInput field box
Custom——————None
DatePickerYesYesYesYesYesYesInput field box
DateRangePickerYesYesYesYesYesYesInput field box
Divider———Line color—YesLine
Email InputYesYesYesYesYesYesInput field box
Embed—————YesWhole widget
FABYes—————Control
File UploadYes————YesWhole widget
Heading——Custom color only——YesText
Icon ButtonYes————YesControl
Image———YesYesYesImage frame
Inline ButtonsYes—————Control
InputYesYesYesYesYesYesInput field box
KeyValueYes————YesWhole widget
LinkYes————YesControl
ListYesYesYesYesYesYesSurface
Map Chart—Yes—YesYesYesOuter card
Markdown——Yes——YesText
Media—Yes—YesYesYesOuter card
Menu ButtonYes————YesControl
ModalYesYes, or gradientYesYesYesYesDialog surface
Multiline InputYesYesYesYesYesYesInput field box
MultiSelectYesYesYesYesYesYesInput field box
Number InputYesYesYesYesYesYesInput field box
Paragraph——Custom color only——YesText
Password InputYesYesYesYesYesYesInput field box
Phone InputYesYesYesYesYesYesInput field box
ProgressYes————YesControl
Radio GroupYes————YesControl
RatingYes————YesControl
Rich Text EditorYes————YesWhole widget
SearchYesYesYesYesYesYesInput field box
SectionYesCustom color or gradientYesYesYesYesSurface
SelectYesYesYesYesYes—Input field box
SheetYesYes, or gradientYesYesYesYesDialog surface
Signature—————YesWhole widget
SliderYes————YesControl
StatsYesCustom color or gradientYesCustom color onlyYesYesSurface
SwitchYes————YesControl
Switch GroupYes————YesControl
TableYes————YesWhole widget
TabsYesYesYesYesYesYesSurface
TagGroupYes————YesControl
Text ListYesYesYesYesYesYesSurface
Toolbar ButtonsYes—————Control
TreeYes————YesWhole widget
Tree SelectYesYesYesYesYesYesInput field box
ZoneYesYes, or gradientYesYesYesYesSurface

Two widget types have no page of their own. WDS_TABLE_WIDGET has the same settings as Table, and WDS_AI_CHAT_WIDGET has the same settings as Chat.

Custom CSS​

Custom CSS adds your own CSS to one widget. It is the last setting in the Custom styling section. Toolbar Buttons, Inline Buttons, FAB, Select, ComboBox, and Custom do not have it. Each of their pages says why.

  • Plain CSS only. You cannot bind it. CSS that contains {{ is ignored as a whole.
  • Rules apply only inside the widget. Appsmith places every selector inside the widget, so a rule cannot style another widget or the page.
  • & is the styled part. On a control or a field, such as a Button or an Input, & is the box around the widget, not the part inside it. To style an inner part, use its element selector, for example button or input. On the Table, & is the table. On a Modal or Sheet, & is the dialog surface.
  • The widget keeps its box. Nothing the CSS draws can reach more than 8 px outside the widget. A z-index above 10 is lowered to 10, and it applies only inside the widget.
  • Size limit. CSS longer than 20 KB (20,480 characters) is ignored as a whole.

Example:

& { letter-spacing: 0.02em; }
&:hover { opacity: 0.9; }
@media (max-width: 600px) {
& { font-size: 14px; }
}

What Appsmith removes​

Appsmith removes these parts and keeps the rest of the CSS:

  • At-rules other than @media and @supports, such as @import, @font-face, @keyframes, and @layer.
  • Declarations that load a resource or read page data, such as url(), image-set(), image(), cross-fade(), element(), paint(), attr(), expression(), and javascript:.
  • position values other than static, relative, and absolute. So position: fixed and position: sticky are removed.
  • Selectors that reach a sibling of the widget with + or ~, such as & + div or &:hover ~ .x.
  • Selectors that use & anywhere but at the start.
  • Selectors that reach the browser's top layer, such as ::backdrop, :modal, :popover-open, and :fullscreen.
  • Selectors and declarations that contain a backslash (\).
  • A :has() inside another :has().

Appsmith ignores the whole CSS when:

  • A quoted string contains a line break, or a string does not close.
  • The CSS cannot be parsed.
  • The browser cannot check the result. Older browsers without constructed style sheets show no custom CSS.

Keep focus rings​

Do not remove focus rings, such as outline or box-shadow on a focused element. Keyboard users need them to see which element has focus.

Recover a widget that custom CSS hides​

If custom CSS hides a widget in the editor, turn custom CSS off while you fix it:

  1. Open the command palette with Ctrl + Shift + P (Windows and Linux) or Cmd + Shift + P (Mac).
  2. Run Show without custom CSS.

The editor then shows every widget without its custom CSS. Only you see this, in the editor. The app is not changed. To turn custom CSS back on, run Show custom CSS, or click the button in the notice. Leaving the editor also turns it back on.

Turn off custom CSS for the organization​

An administrator can turn off Allow custom CSS in responsive apps in the Responsive app theme page of Admin Settings. It is on by default.

While it is off:

  • No responsive app shows custom CSS, published apps included.
  • The CSS stays saved in each app.
  • In the property pane, Custom CSS is read-only and shows the message Custom CSS is turned off by your admin. Your CSS is kept.

If the organization settings cannot be loaded, apps show no custom CSS.

MCP agents​

Agents that build apps through the MCP Server cannot set Custom CSS.

caution

Treat Custom CSS as code. Write it yourself and keep it static. Do not build it from user input, query results, or other data that app users can change.