Styling
Every Ecc component and widget gets its look from CSS only: classes and --ecc-* design tokens. The components contain no inline styles, and your pages should not contain any either. To change the look of your application, you change one CSS file in your workspace.
Where the CSS comes from
The CSS is written into the page in this order. A later rule wins over an earlier rule of the same specificity.
1 |
| all rules of the components, page frame, tables, fields - the same for every theme |
2 |
| only values: the design tokens of the theme the user picked (ecceene or Carbon) |
3 |
| process widgets: tiles, instance, tasks, history, diagram, settings |
4 | your workspace |
|
Your CSS file
The workspace template contains src/apps/app.css and passes it in main.tsx:
import appCss from "./apps/app.css?inline";
startEccAtm({
// ...
css: appCss,
});
In this file you can do three things:
/* 1. Change design tokens for the whole application */
:root {
--ecc-color-action: #0b6e4f;
--ecc-font-family: "Source Sans 3", Helvetica, Arial, sans-serif;
}
/* 2. Change a component through its classes */
.ecc-panel-header--grey { background: var(--ecc-color-layer-02); }
.ecc-timeline__name { font-weight: 400; }
/* 3. Classes for your own pages, prefixed with the app name */
.purchase-summary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ecc-spacing-05); }
The classes of each component are listed in the section CSS of its page, for example EccPanel or EccProcessHistory.
Design tokens
Tokens are CSS custom properties on :root. Change a token and every component that uses it follows.
| text, code and JSON |
| body text, small text, tags and hints |
| headings |
| text, primary buttons |
| secondary text, muted text and icons |
| links, active filters and tabs, focus |
| states and messages |
| page background, widgets and boxes |
| input fields, lines and borders |
| spacing from 2 px to 160 px |
| height of fields and buttons |
| field labels |
Always use tokens instead of fixed colours in your own CSS, so your pages follow the theme the user picked.
Classes for states and layout
These classes are the same in every widget and page. Use them in your own pages, too.
| spinner and text in one line; |
| "nothing to show", centred and muted |
| error inside a widget: headline with icon, message below |
| placeholder lines while a detail view loads |
| key figure of a widget: big number and unit |
| plain white area without a widget frame |
| buttons next to each other; |
| content of one tab, see below |
| field in the error colour (label and value) |
| field without the spacing below |
| colour of a process state, e.g. a state icon in a list |
| hint for developers, e.g. a missing renderer |
<div className="ecc-loading ecc-loading--center">
<EccIcon icon="fa-solid fa-circle-notch" spin /> {t("system.loading")}
</div>
<EccIcon icon={ICON_CLASSES["process-active"]} className={`ecc-process-state--${process.state.toLowerCase()}`} />
Showing and hiding
Hide content with the hidden attribute, not with a style. Content of inactive tabs stays mounted, so its fields keep their values and the page footer still collects them:
<div className="ecc-tab-pane" hidden={tab !== "request"}>...</div>
<div className="ecc-tab-pane" hidden={tab !== "history"}>...</div>
To hide fields depending on other values, use EccHideable with the Page Validator.
Rules
- No
style={...}in pages. The Ecc components have nostyleprop; useclassNameand your CSS file. - Own classes start with the name of your app (
purchase-...), so they never collide withecc-*classes. - Use the tokens (
var(--ecc-...)) instead of fixed values. - Change existing components through their classes in your CSS file, not by wrapping them in elements with styles.
On this page
- Styling