Using Custom CSS

NUI supports adding Custom CSS in various places. A common syntax is used everywhere

NUI offers a simpler syntax for defining CSS. This syntax avoids the base selector (handled automatically by the library). Using semicolon ; and curly braces {} is optional (but can still be used).

Basic Example

font-size: 20px
color: red

This example can also be written as

{
   font-size: 20px;
   color: red;
}

Using Anvil Theme Colors

You can also use Anvil theme colors in your CSS similar to how you use them in code.

font-size: 20px
color: theme:Primary

Support for CSS selectors

You can use any CSS selector just as you normally use them. The only difference is the omit of the main selector

CSS for Icons

You can write CSS for icons by using the selector

Components have an Icon CSS property already. You only need this in presets

Last updated