Custom CSS

Add custom stylesheets to override default styles, target specific components, and fine-tune your site's visual design.

Add custom CSS files to your documentation project to style any element beyond what the built-in theme exposes. Your stylesheets load after the default theme, so your rules take priority.

Start with Colors & Typography for brand colors, headings, and text. Use custom CSS when you need layout tweaks, component-level styling, or overrides the theme settings don't cover.

Prerequisites

You need publishing access and either a .css file in your project or an external HTTPS stylesheet URL.

Configure custom CSS from the Editor

Use the Editor when you want to add or update styles without editing documentation.json directly.

Open Site Config

In the Editor, click Site Config in the top toolbar.

Navigate to Custom CSS

Select Custom CSS from the left sidebar.

Add a stylesheet

Click Add Stylesheet and select a CSS file from your project. Only .css files appear in the picker.

You can also paste an external stylesheet URL instead of selecting a project file.

Publish

Click Publish to deploy the stylesheet to your live site.

After publishing, refresh your site and confirm the updated styles appear where you expect them.

Configure custom CSS in documentation.json

Use documentation.json when you manage site configuration in version control or want stylesheet changes reviewed alongside other documentation updates.

{
  "customCss": [
    { "src": "styles/custom.css" },
    { "src": "https://cdn.example.com/external-styles.css" }
  ]
}

Each item in the customCss array is an object with one field. A plain string instead of an object is ignored.

  • src (string, required): Relative path to a .css file in your project, or an external HTTPS URL

File requirements

Follow these rules when adding a stylesheet:

  • Files must use a .css extension
  • Paths are relative to the project root, such as styles/brand.css
  • Maximum file size is 1 MB per file
  • The file must exist in your documentation project when you publish
  • External URLs should use HTTPS, because browsers block HTTP stylesheets on HTTPS sites

A project stylesheet that is missing, larger than 1 MB, or has an invalid path does not fail your deployment. It is skipped, and the rest of your site publishes as usual.

CSS paths must be relative. Do not start paths with /, ./, or ../. Path traversal patterns are rejected for security.

Component class names

Documentation.AI exposes stable dai-* class names on major layout regions, navigation elements, and MDX components. Use these selectors when you want precise styling without relying on generated or browser-inspected class names that may change.

Layout and structure

ClassComponent
dai-layoutRoot layout wrapper
dai-layout-atlasAtlas template layout
dai-layout-classicClassic template layout
dai-content-areaMain content area
dai-content-columnContent column
dai-sidebar-columnSidebar column
dai-pagePage wrapper
dai-page-mainMain content panel
dai-articleArticle or MDX container
dai-page-asideSide panel or table of contents area
dai-footer"Last updated" under the page. On sites without a footer, the row that also holds the "Built with Documentation.AI" link
dai-page-navPrevious and next navigation
dai-breadcrumbsBreadcrumbs
dai-sticky-headerSticky header

These classes style banners. The bar also carries a data-type attribute with its type: info, alert, or danger. For the variables that set each part's colour, see Style banners with custom CSS.

ClassComponent
dai-bannerBanner bar
dai-banner-iconType icon
dai-banner-contentBanner text
dai-banner-linkLink in the banner text
dai-banner-closeClose button
ClassComponent
dai-navbarNavbar container
dai-navbar-atlasAtlas template navbar
dai-navbar-classicClassic template navbar
dai-logoLogo area
dai-navbar-searchSearch section
dai-navbar-tabsTab navigation
dai-navbar-buttonsAction buttons area
dai-navbar-dropdownNavbar dropdown trigger
dai-navbar-languagesLanguage selector
dai-navbar-versionsVersion selector
dai-navbar-productsProduct selector
dai-navbar-actions-mobileMobile navbar actions

These classes style the site footer. Each social icon also carries a data-platform attribute with its platform name, such as data-platform="github".

ClassComponent
dai-site-footerFooter container
dai-site-footer-socialsRow of social icons
dai-site-footer-socialOne social icon link
dai-site-footer-columnsLink groups area
dai-site-footer-columnOne link group
dai-site-footer-column-titleLink group heading
dai-site-footer-linkLink in a link group
dai-site-footer-bottomLast line, with the copyright notice and credit
dai-site-footer-copyrightCopyright notice
dai-site-footer-credit"Built with Documentation.AI" link
ClassComponent
dai-sidebarSidebar container
dai-sidebar-atlasAtlas template sidebar
dai-sidebar-classicClassic template sidebar
dai-sidebar-contentSidebar navigation content
dai-sidebar-groupNavigation group
dai-sidebar-group-titleGroup title
dai-sidebar-pagePage link
dai-sidebar-page-activeActive page link
dai-sidebar-page-groupPage group or expandable section
dai-sidebar-page-group-titlePage group title
dai-sidebar-dropdownSidebar dropdown
dai-sidebar-dropdown-itemSidebar dropdown item
dai-sidebar-tabsSidebar tabs
dai-sidebar-tab-itemSidebar tab item
dai-sidebar-menuSidebar menu
dai-sidebar-menu-itemSidebar menu item
dai-sidebar-mobileMobile sidebar trigger

Search and AI

ClassComponent
dai-searchSearch bar
dai-search-atlasAtlas template search
dai-search-classicClassic template search
dai-search-modalSearch modal
dai-agent-chatAI assistant chat
dai-ask-ai-buttonAsk AI button

Table of contents

ClassComponent
dai-tocTable of contents wrapper
dai-toc-listTable of contents headings list
dai-toc-itemTable of contents link
dai-toc-item-activeActive table of contents link
dai-toc-actionsTable of contents action buttons

MDX components

ClassComponent
dai-callout-iconCallout icon
dai-callout-bodyCallout body
dai-card-titleCard title
dai-card-descriptionCard description
dai-card-imageCard image
dai-code-copyCode copy button
dai-code-tabsCode group tabs
dai-param-nameParameter field name
dai-param-typeParameter field type
dai-param-requiredParameter required badge
dai-param-badgeParameter badge
dai-endpoint-badgeEndpoint badge in the page title
dai-step-numberStep number
dai-step-contentStep content
dai-step-connectorStep connector line
dai-collection-nodeCollection node
dai-board-card-detailBoard card detail dialog

API playground

ClassComponent
dai-api-authAPI playground auth section
dai-api-request-previewAPI request preview
dai-api-responseAPI response

Sign-in screens

These classes style the screens readers see before they can open a protected site: the password screen and the email verification screen. Your custom CSS loads on these screens too, so one stylesheet covers both your docs and their sign-in.

ClassComponent
dai-sign-in-gateFull-screen background behind the sign-in box
dai-sign-in-gate-passwordPassword screen, on the same element as dai-sign-in-gate
dai-sign-in-gate-email-verificationEmail verification screen, on the same element as dai-sign-in-gate
dai-sign-in-gate-email-stepEmail verification step where readers enter their email
dai-sign-in-gate-code-stepEmail verification step where readers enter the code
dai-sign-in-gate-request-status-stepEmail verification step that shows the status of an access request
dai-sign-in-gate-cardSign-in box
dai-sign-in-gate-headerIcon, title, and description at the top of the box
dai-sign-in-gate-iconIcon
dai-sign-in-gate-titleTitle
dai-sign-in-gate-descriptionLine under the title
dai-sign-in-gate-formFields and buttons
dai-sign-in-gate-inputPassword, email, or code field
dai-sign-in-gate-consentConsent checkbox and its label
dai-sign-in-gate-consent-checkboxConsent checkbox
dai-sign-in-gate-errorError message
dai-sign-in-gate-submitMain button
dai-sign-in-gate-actionsRow of secondary actions, such as Resend code
dai-sign-in-gate-actionOne secondary action
dai-sign-in-gate-helper-textHelper text under the password field
dai-sign-in-gate-linkLink in the helper text or consent label

The step classes sit on the same element as dai-sign-in-gate-email-verification. Sites styled before these classes existed can keep using dai-password-gate, which is on the same element as dai-sign-in-gate on both screens.

Other

ClassComponent
dai-feedbackFeedback widget
dai-theme-toggleTheme toggle button
dai-theme-selectTheme select dropdown
dai-access-deniedAccess denied page

CSS variables

Override built-in CSS custom properties when you want to adjust theme-driven colors without rewriting component selectors. These variables layer on top of the theme colors defined in documentation.json.

:root {
  --brand: #3143e3;
  --brand-text: #ffffff;
  --heading: #1a1a1a;
  --body: #374151;
  --navbar-bg: #ffffff;
  --sidebar-bg: #f9fafb;
  --content-bg: #ffffff;
  --footer-border: #e5e7eb;
  --toc-text: #6b7280;
  --toc-active-text: #3143e3;
}

.dark {
  --brand: #85a1ff;
  --brand-text: #000000;
  --heading: #f2f2f2;
  --body: #c1c1c1;
  --navbar-bg: #0f0f0f;
  --sidebar-bg: #111111;
  --content-bg: #0f0f0f;
  --footer-border: #262626;
  --toc-text: #9ca3af;
  --toc-active-text: #85a1ff;
}

Use the built-in theme color settings for your primary brand, heading, and body text colors whenever possible. CSS variables are most useful when you need more specific control over elements such as the navbar background, sidebar background, footer border, or table of contents colors.

For dark mode overrides, scope variable changes or selector-based styles under .dark. That keeps your light and dark themes predictable and avoids unintended color combinations.

Examples

Start with a small, targeted rule and verify it on a published page before expanding to broader overrides.

Change the sidebar background

.dai-sidebar {
  background-color: #f8fafc;
}

.dark .dai-sidebar {
  background-color: #0f172a;
}

Add custom navbar styling

.dai-navbar {
  border-bottom: 2px solid var(--brand);
  backdrop-filter: blur(12px);
}

Highlight the active table of contents item

.dai-toc-item-active {
  font-weight: 600;
  border-left: 3px solid var(--brand);
  padding-left: 8px;
}

Adjust callout body text

.dai-callout-body {
  font-size: 0.9rem;
  line-height: 1.6;
}

Add a background image to the sign-in screen

.dai-sign-in-gate {
  background-image: url("https://cdn.example.com/sign-in-background.jpg");
  background-size: cover;
  background-position: center;
}

.dai-sign-in-gate-card {
  background-color: rgba(255, 255, 255, 0.9);
}

.dark .dai-sign-in-gate-card {
  background-color: rgba(15, 15, 15, 0.9);
}

Use a full image URL. A path to an image in your project does not load from a stylesheet. Upload the image to the media library and copy its URL.

Loading order

Styles load in this order:

  1. Built-in base styles for layout and components
  2. Theme CSS variables from the documentation.json colors configuration
  3. Custom CSS stylesheets from your customCss array, in the order listed

Because custom stylesheets load last, they can override earlier styles.

Security

  • Local files are served from a secure CDN. Path traversal patterns such as ../ are rejected.
  • External URLs should point to trusted sources only.

Troubleshooting

What's next