Styling
Hosted apps look tidy without any effort on your part and adapt to the host's light or dark theme. If you want more – club colours, rounded buttons, your own tab bar – you write real CSS in styling.css. The file sits in the Code area next to app.json and main.js and is loaded after the built-in styles: it may override anything.
The tables on this page are generated from the runtime's STYLE_REFERENCE – the same source the built-in styles and the styling.css template are built from.
The quick way: variables
All components read their colours, spacing and radii from CSS variables. You can cover most needs by overriding a few of them in :root:
:root {
--mc-color-primary: #0b7a3b;
--mc-color-primary-soft: #e3f4ea;
--mc-radius: 12px;
}
| Variable | Default | Used for |
|---|---|---|
--mc-color-primary | #4c6ef5 | Primary colour: primary buttons, active tabs, focus outline |
--mc-color-primary-contrast | #ffffff | Text on the primary colour |
--mc-color-primary-soft | #edf2ff | Light shade of the primary colour, e.g. hover in tables, light buttons |
--mc-color-text | #1a1b1e | Text colour |
--mc-color-muted | #6b7280 | Muted text, labels, empty lists |
--mc-color-background | #ffffff | Background of the app and of input fields |
--mc-color-surface | #f8f9fa | Background of cards and table headers |
--mc-color-border | #dee2e6 | Borders of cards, fields, tables and lists |
--mc-color-danger | #fa5252 | Colour for delete and errors |
--mc-color-danger-contrast | #ffffff | Text on the danger colour |
--mc-radius | 8px | Corner radius of buttons, fields, cards and tables |
--mc-font-family | system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif | Font of the app |
--mc-font-size | 14px | Base font size |
--mc-spacing | 16px | Padding of the app and of cards |
--mc-gap | 12px | Gap between elements in cards |
--mc-button-padding | 8px 14px | Padding of buttons |
--mc-button-font-weight | 600 | Font weight of buttons |
--mc-input-height | 36px | Minimum height of input fields and selects |
--mc-input-padding | 7px 10px | Padding of input fields |
--mc-table-cell-padding | 8px 12px | Padding of table cells |
--mc-tabs-indicator | var(--mc-color-primary) | Colour of the line under the active tab |
--mc-shadow | 0 4px 16px rgba(0, 0, 0, 0.2) | Shadow of notices (toasts) |
Selectors
Every component carries fixed classes that do not change, and the data-mc-id attribute with its id from app.json. You assign your own classes in the builder under "CSS class" (in app.json: props.className).
| Selector | What |
|---|---|
.mc-app | The whole app |
[data-mc-id="<id>"] | Exactly one element; the builder shows the ID under the element's name |
.mc-stack | Stack (layout) |
.mc-grid | Grid (layout) |
.mc-card | Card |
.mc-card__title | Title of a card |
.mc-heading | Heading |
.mc-heading--h1 … .mc-heading--h4 | Heading per level |
.mc-text | Text |
.mc-button | Button |
.mc-button--primary | Filled button (default) |
.mc-button--secondary | Light, outlined or subtle button |
.mc-button--danger | Red button |
.mc-field | Label and input of a form field |
.mc-input | Text field |
.mc-select | Select |
.mc-checkbox | Checkbox with label |
.mc-date | Date field |
.mc-table | Table |
.mc-table__head | Table header |
.mc-table__row | Table row |
.mc-table__cell | Table cell (also in the header) |
.mc-list | List |
.mc-list__item | List entry |
.mc-tabs | Tabs |
.mc-tabs__list | Bar with the tab buttons |
.mc-tabs__tab | A tab button |
.mc-tabs__tab--active | The active tab button |
.mc-tabs__panel | Content of the active tab |
.mc-image | Image |
.mc-chart | Chart |
.mc-empty | Text shown when tables and lists have no entries |
.mc-toast | Notice outside a host |
The classes follow a fixed pattern: .mc-<baustein> for the component, .mc-<baustein>__<teil> for its parts, .mc-<baustein>--<variante> for variants. Other classes and the HTML structure underneath are not guaranteed – rely only on the table above.
A button with the id speichern and the CSS class gross appears in the HTML like this:
<button type="button" class="mc-button mc-button--primary gross" data-mc-id="speichern">Speichern</button>
Examples
Club colours
:root {
--mc-color-primary: #b3121b;
--mc-color-primary-contrast: #ffffff;
--mc-color-primary-soft: #fbe9ea;
--mc-tabs-indicator: #b3121b;
}
/* In the dark theme the runtime sets its own colours – override them there as well. */
:root[data-mc-theme="dark"] {
--mc-color-primary: #ff6b72;
--mc-color-primary-contrast: #1a0507;
--mc-color-primary-soft: #3a1416;
}
Pill-shaped buttons
.mc-button {
border-radius: 999px;
--mc-button-padding: 10px 20px;
}
.mc-button--primary {
text-transform: uppercase;
letter-spacing: 0.04em;
}
.mc-button--danger {
background: transparent;
color: var(--mc-color-danger);
}
Dark tab bar
.mc-tabs__list {
background: #1a1b1e;
border: none;
border-radius: var(--mc-radius);
padding: 4px;
}
.mc-tabs__tab {
color: #adb5bd;
border: none;
border-radius: calc(var(--mc-radius) - 2px);
}
.mc-tabs__tab--active {
background: #373a40;
color: #ffffff;
}
Zebra table and highlighted column
.mc-table__row:nth-child(even) .mc-table__cell {
background: var(--mc-color-surface);
}
[data-mc-id="termine"] .mc-table__cell:first-child {
font-weight: 600;
}
A single element
[data-mc-id="heading-1"] {
color: var(--mc-color-primary);
font-size: 28px;
}
/* custom class from the builder */
.hinweis {
border-left: 3px solid var(--mc-color-primary);
padding-left: 12px;
}
Background image
.mc-app {
background: url("https://cdn.example.de/verein/wappen.png") no-repeat right 16px top 16px / 64px;
}
What the security policy allows
Hosted apps run under a strict Content Security Policy. For CSS this means:
| What | Allowed? |
|---|---|
styling.css and other .css files of the draft | yes |
| Inline styles | yes |
@import from external addresses | no |
Images in url(…) via https: or as data: | yes |
Images via http: | no |
Web fonts (@font-face, Google Fonts, also as data:) | no – use system fonts via --mc-font-family |
The full policy of the run shell:
default-src 'none'; script-src 'self' <runtime-cdn>; style-src 'self' 'unsafe-inline' <runtime-cdn>;
img-src https: data:; connect-src 'self' https://*.api.methacore.de <developer-portal-api>;
frame-ancestors <dashboard> <studio>; base-uri 'none'; form-action 'none'
Light and dark theme
On start, the host tells the app whether it is light or dark, and reports every change. The runtime then sets data-mc-theme="light" or "dark" on the <html> element. Outside a host it follows prefers-color-scheme.
In the dark theme the runtime overrides these variables: background, surface, text, muted text, border and the three primary colours. Because :root[data-mc-theme="dark"] is more specific than :root, the runtime wins there over your values in :root. If you want your colours in the dark theme too, also set them under :root[data-mc-theme="dark"] (see Club colours). If your app should always look the same, write both rules with the same values.
Check your styling in both themes before you submit a version.
The template
Every new app starts with this styling.css. It lists all variables with their default values; delete what you do not need.
/*
* styling.css – custom app appearance with real CSS.
*
* This file is loaded after the built-in styles and may override anything.
* The easiest way is to adjust the variables below. Every component also has fixed
* classes (e.g. .mc-button, .mc-table__cell) and the data-mc-id attribute with its ID,
* so you can target individual elements: [data-mc-id="button-1"] { … }
* You assign your own classes in the builder under "CSS class".
*
* External files (@import, url() to external addresses) are blocked by the app's security policy.
*/
:root {
/* Primary colour: primary buttons, active tabs, focus outline */
--mc-color-primary: #4c6ef5;
/* Text on the primary colour */
--mc-color-primary-contrast: #ffffff;
/* Light shade of the primary colour, e.g. hover in tables, light buttons */
--mc-color-primary-soft: #edf2ff;
/* Text colour */
--mc-color-text: #1a1b1e;
/* Muted text, labels, empty lists */
--mc-color-muted: #6b7280;
/* Background of the app and of input fields */
--mc-color-background: #ffffff;
/* Background of cards and table headers */
--mc-color-surface: #f8f9fa;
/* Borders of cards, fields, tables and lists */
--mc-color-border: #dee2e6;
/* Colour for delete and errors */
--mc-color-danger: #fa5252;
/* Text on the danger colour */
--mc-color-danger-contrast: #ffffff;
/* Corner radius of buttons, fields, cards and tables */
--mc-radius: 8px;
/* Font of the app */
--mc-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
/* Base font size */
--mc-font-size: 14px;
/* Padding of the app and of cards */
--mc-spacing: 16px;
/* Gap between elements in cards */
--mc-gap: 12px;
/* Padding of buttons */
--mc-button-padding: 8px 14px;
/* Font weight of buttons */
--mc-button-font-weight: 600;
/* Minimum height of input fields and selects */
--mc-input-height: 36px;
/* Padding of input fields */
--mc-input-padding: 7px 10px;
/* Padding of table cells */
--mc-table-cell-padding: 8px 12px;
/* Colour of the line under the active tab */
--mc-tabs-indicator: var(--mc-color-primary);
/* Shadow of notices (toasts) */
--mc-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
/* Examples – remove the comment markers to use them:
.mc-button--primary {
border-radius: 999px;
text-transform: uppercase;
}
.mc-table__row:nth-child(even) .mc-table__cell {
background: var(--mc-color-surface);
}
[data-mc-id="heading-1"] {
color: var(--mc-color-primary);
}
*/