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.cssfile in your project, or an external HTTPS URL
File requirements
Follow these rules when adding a stylesheet:
- Files must use a
.cssextension - 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
| Class | Component |
|---|---|
dai-layout | Root layout wrapper |
dai-layout-atlas | Atlas template layout |
dai-layout-classic | Classic template layout |
dai-content-area | Main content area |
dai-content-column | Content column |
dai-sidebar-column | Sidebar column |
dai-page | Page wrapper |
dai-page-main | Main content panel |
dai-article | Article or MDX container |
dai-page-aside | Side 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-nav | Previous and next navigation |
dai-breadcrumbs | Breadcrumbs |
dai-sticky-header | Sticky header |
Banner
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.
| Class | Component |
|---|---|
dai-banner | Banner bar |
dai-banner-icon | Type icon |
dai-banner-content | Banner text |
dai-banner-link | Link in the banner text |
dai-banner-close | Close button |
Navbar
| Class | Component |
|---|---|
dai-navbar | Navbar container |
dai-navbar-atlas | Atlas template navbar |
dai-navbar-classic | Classic template navbar |
dai-logo | Logo area |
dai-navbar-search | Search section |
dai-navbar-tabs | Tab navigation |
dai-navbar-buttons | Action buttons area |
dai-navbar-dropdown | Navbar dropdown trigger |
dai-navbar-languages | Language selector |
dai-navbar-versions | Version selector |
dai-navbar-products | Product selector |
dai-navbar-actions-mobile | Mobile navbar actions |
Footer
These classes style the site footer. Each social icon also carries a data-platform attribute with its platform name, such as data-platform="github".
| Class | Component |
|---|---|
dai-site-footer | Footer container |
dai-site-footer-socials | Row of social icons |
dai-site-footer-social | One social icon link |
dai-site-footer-columns | Link groups area |
dai-site-footer-column | One link group |
dai-site-footer-column-title | Link group heading |
dai-site-footer-link | Link in a link group |
dai-site-footer-bottom | Last line, with the copyright notice and credit |
dai-site-footer-copyright | Copyright notice |
dai-site-footer-credit | "Built with Documentation.AI" link |
Sidebar
| Class | Component |
|---|---|
dai-sidebar | Sidebar container |
dai-sidebar-atlas | Atlas template sidebar |
dai-sidebar-classic | Classic template sidebar |
dai-sidebar-content | Sidebar navigation content |
dai-sidebar-group | Navigation group |
dai-sidebar-group-title | Group title |
dai-sidebar-page | Page link |
dai-sidebar-page-active | Active page link |
dai-sidebar-page-group | Page group or expandable section |
dai-sidebar-page-group-title | Page group title |
dai-sidebar-dropdown | Sidebar dropdown |
dai-sidebar-dropdown-item | Sidebar dropdown item |
dai-sidebar-tabs | Sidebar tabs |
dai-sidebar-tab-item | Sidebar tab item |
dai-sidebar-menu | Sidebar menu |
dai-sidebar-menu-item | Sidebar menu item |
dai-sidebar-mobile | Mobile sidebar trigger |
Search and AI
| Class | Component |
|---|---|
dai-search | Search bar |
dai-search-atlas | Atlas template search |
dai-search-classic | Classic template search |
dai-search-modal | Search modal |
dai-agent-chat | AI assistant chat |
dai-ask-ai-button | Ask AI button |
Table of contents
| Class | Component |
|---|---|
dai-toc | Table of contents wrapper |
dai-toc-list | Table of contents headings list |
dai-toc-item | Table of contents link |
dai-toc-item-active | Active table of contents link |
dai-toc-actions | Table of contents action buttons |
MDX components
| Class | Component |
|---|---|
dai-callout-icon | Callout icon |
dai-callout-body | Callout body |
dai-card-title | Card title |
dai-card-description | Card description |
dai-card-image | Card image |
dai-code-copy | Code copy button |
dai-code-tabs | Code group tabs |
dai-param-name | Parameter field name |
dai-param-type | Parameter field type |
dai-param-required | Parameter required badge |
dai-param-badge | Parameter badge |
dai-endpoint-badge | Endpoint badge in the page title |
dai-step-number | Step number |
dai-step-content | Step content |
dai-step-connector | Step connector line |
dai-collection-node | Collection node |
dai-board-card-detail | Board card detail dialog |
API playground
| Class | Component |
|---|---|
dai-api-auth | API playground auth section |
dai-api-request-preview | API request preview |
dai-api-response | API 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.
| Class | Component |
|---|---|
dai-sign-in-gate | Full-screen background behind the sign-in box |
dai-sign-in-gate-password | Password screen, on the same element as dai-sign-in-gate |
dai-sign-in-gate-email-verification | Email verification screen, on the same element as dai-sign-in-gate |
dai-sign-in-gate-email-step | Email verification step where readers enter their email |
dai-sign-in-gate-code-step | Email verification step where readers enter the code |
dai-sign-in-gate-request-status-step | Email verification step that shows the status of an access request |
dai-sign-in-gate-card | Sign-in box |
dai-sign-in-gate-header | Icon, title, and description at the top of the box |
dai-sign-in-gate-icon | Icon |
dai-sign-in-gate-title | Title |
dai-sign-in-gate-description | Line under the title |
dai-sign-in-gate-form | Fields and buttons |
dai-sign-in-gate-input | Password, email, or code field |
dai-sign-in-gate-consent | Consent checkbox and its label |
dai-sign-in-gate-consent-checkbox | Consent checkbox |
dai-sign-in-gate-error | Error message |
dai-sign-in-gate-submit | Main button |
dai-sign-in-gate-actions | Row of secondary actions, such as Resend code |
dai-sign-in-gate-action | One secondary action |
dai-sign-in-gate-helper-text | Helper text under the password field |
dai-sign-in-gate-link | Link 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
| Class | Component |
|---|---|
dai-feedback | Feedback widget |
dai-theme-toggle | Theme toggle button |
dai-theme-select | Theme select dropdown |
dai-access-denied | Access 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:
- Built-in base styles for layout and components
- Theme CSS variables from the
documentation.jsoncolors configuration - Custom CSS stylesheets from your
customCssarray, 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
Colors and typography
Use built-in theme settings to control brand colors, headings, and text styles before adding custom selectors.
Custom scripts
Add custom JavaScript for analytics, widgets, or site-specific behavior.
Templates
Compare Atlas and Classic layouts and decide which structure fits your documentation.
Site configuration
Review the full documentation.json reference for site-wide configuration options.