API Portal
Custom CSS and Markdoc partials
Style your API Portal with custom CSS, using the portal's class names and colour variables, and reuse content across products' Product Overview pages with Markdoc partials. Both are settings under Portal settings, available on plans that include them.
Two settings let you go beyond Theme. Custom CSS restyles your API Portal with your own stylesheet, and Markdoc Partials let you write content once and reuse it on every product's Product Overview. Both are available on plans that include them. For the rest of the portal, see the API Portal overview.
How do you add custom CSS to your API Portal?
Open Settings, Portal settings, Custom CSS. Write CSS in the editor or load a file with Upload, then choose Save Changes. The portal adds your stylesheet after its own, so your rules apply on top of the theme.
- Open Settings, Portal settings, Custom CSS.
- Write your CSS in the editor, or choose Upload to load a
.cssfile into it. - Fix any errors listed under the editor. Save Changes stays disabled while there are errors.
- Choose Save Changes. It enables once the CSS has changed.
Test a change on your portal after you save it. A broad rule can restyle more than you expect.
Which class names can you target?
Target the portal's own class names. The table lists stable ones for the main regions. Open /kitchen_sink/css on your portal for a mock page labelled with region names.
| Class | What it styles |
|---|---|
.portal-desk-header-container | The header on screens 1024 pixels wide and wider. |
.portal-mobile-header-container | The header on narrower screens. |
.portal-desk-header-item | A menu item in the wide header. |
.portal-footer | The footer. |
.portal-card | Product, subscription, team and credential cards. |
.productCard, .subscriptionCard, .teamCard | One kind of card. |
.portal-button | Buttons. .portal-button.color-primary and .portal-button.color-secondary are the two brand variants. |
Which colours can you change with custom CSS?
Change the colour variables the theme does not set. The brand colours and button text colours come from Portal, Theme and are applied on the page itself, so they outrank your stylesheet. Change those in Theme.
The other colour variables are defined for the portal's light theme. Override them with the same selector, :root[data-theme='light']. A plain :root rule is less specific and has no effect.
| Variable | What it colours |
|---|---|
--portal-body-text-color-primary | Main body text. |
--portal-body-text-color-secondary | Secondary body text. |
--portal-heading-text-color-primary | Main headings. |
--portal-background-color | The background of the home, product and documentation pages, and of cards. |
--portal-background-color-secondary | The background of the other pages, such as subscriptions and teams. |
--portal-link-color | Menu items on hover and a few links, such as the terms link at sign-up. |
--portal-border-color | Borders. |
--portal-info-color, --portal-warning-color, --portal-error-color, --portal-success-color | Status messages. |
The Colors block on /kitchen_sink lists every variable with a swatch of its current value. This example changes body text and the page background, and rounds the cards:
:root[data-theme='light'] {
--portal-body-text-color-primary: #1a1a2e;
--portal-background-color-secondary: #f7f5ff;
}
.portal-card {
border-radius: 12px;
}What are Markdoc partials?
Markdoc partials are reusable blocks of Markdoc that you write once and use on any product's Product Overview tab. Each variable you write with a dollar sign, such as $contactEmail, becomes a field that each product fills in with its own value.
You edit them in Settings, Portal settings, Markdoc Partials, with a Preview beside the Markdoc Editor. On a product's Product Overview tab, you pick a partial and enter a value for each of its variables. Variables that start with $product. do not become fields.
How do you create and edit a Markdoc partial?
Pick a partial in Select Partial Template, or choose Add New and give it a name. Edit it in the Markdoc Editor, check the Preview, then choose Save Changes. Adding, renaming, deleting and importing change the list in front of you. Save Changes stores it.
| Control | What it does |
|---|---|
| Select Partial Template | Opens a partial in the editor and preview. |
| Add New | Asks for a name and adds an empty partial. |
| Rename | Renames the selected partial. |
| Delete | Removes the selected partial after you confirm. |
| Export All | Downloads all partials as a JSON file. |
| Import | Loads partials from a JSON file and replaces the whole list with them. |
| Save Changes | Stores your changes. Enabled when there is something to save. |
Is customization available on every plan?
No. Both settings depend on your plan, and they behave differently when your plan does not include them.
| Setting | When your plan does not include it |
|---|---|
| Custom CSS | The page shows "Please upgrade to access this feature" and a link to talk to sales. The editor does not load. |
| Markdoc Partials | The entry does not appear under Portal settings. |
Troubleshooting
| What you see | What to do |
|---|---|
A colour set with :root does not change | Use :root[data-theme='light']. |
| The primary or secondary colour ignores your CSS | Change it in Portal, Theme. |
.portal-header matches nothing | Use .portal-desk-header-container and .portal-mobile-header-container for the header. |
| Save Changes stays disabled on Custom CSS | The editor lists an error, or nothing has changed. |
| A product lost content after you imported partials | The import replaced the list. Import your exported copy, then choose Save Changes. |