Custom CSS, Design Tokens & Shadow Parts (::part)
Because RapiDoc is built as a standard W3C Web Component, its markup resides inside an isolated Shadow DOM. Safely customize internal styles using CSS Custom Properties (Design Tokens) and standard CSS Shadow Parts (::part()) without breaking encapsulation.
Design Tokens & Shadow Parts Catalog
Both CSS Custom Properties and CSS Shadow Parts are displayed below. Use the search bar or category filters to quickly locate specific tokens or elements across both catalogs.
1. CSS Custom Properties (99)
Surface Colors (shadcn/ui)
shadcn/ui color tokens. Set them on rapi-doc, or use `inherit` to take a shadcn/ui page's :root values.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| oklch(0.2613 0.0134 272.84) (dark) / #ffffff (light) | Page background of the component. | |
| #cccccc (dark) / #444444 (light) | Default text color, including markdown descriptions. | |
| mix of --background and --foreground | Elevated surfaces: dialogs, table headers, tooltips. | |
| derived from --foreground | Text on elevated surfaces. | |
| mix of --background and --foreground | Subtle surfaces: inline code, tags, secondary buttons, scrollbar thumbs. | |
| derived from --foreground | Secondary text: parameter descriptions, constraints, inactive tabs. | |
| mix of --background and --foreground | Dividers and outlines of tables, cards, panels. | |
| slightly stronger than --border | Border color of form fields (shadcn/ui meaning). | |
| #ef4444 (dark) / #dc2626 (light) | Errors, required-field markers, and DEPRECATED labels. |
Brand & Focus (shadcn/ui)
Accent colors. The theme attribute (preset name or hex color) sets --primary, --primary-foreground, and the accent as readable text for each color scheme.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| theme preset (#f76b39 for amber) | Brand accent: buttons, links in navigation, active states. | |
| theme preset (#000000 for amber) | Text on --primary backgrounds. | |
| var(--primary-text-dark) or var(--primary-text-light), by color scheme | The accent as text: links, and allowed values and examples that fill an input. Readable (4.5:1) on the background, cards and accent tints. | |
| computed from the theme (#f76b39 for amber) | --primary-text in the dark color scheme: --primary lightened until it is readable. | |
| computed from the theme (#b24d29 for amber) | --primary-text in the light color scheme: --primary darkened until it is readable. | |
| var(--primary) | Focus ring color. | |
| 0 0 0 1px transparent, 0 0 0 2px color-mix(in srgb, var(--ring) 40%, transparent) | Box shadow used for keyboard focus. | |
| color-mix(in srgb, var(--primary) 25%, transparent) | Background of selected text. | |
| var(--foreground) | Color of selected text. |
Navigation Sidebar (shadcn/ui)
shadcn/ui sidebar tokens for the navigation bar, plus its sizing.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| var(--background) | Navigation bar background. | |
| var(--foreground) | Navigation item text. | |
| var(--primary) | Active item text and its left marker. | |
| slightly darker/lighter than --background | Hovered item background. | |
| var(--foreground) | Hovered item text. | |
| var(--border) | Border between the navigation bar and the content. | |
| var(--ring) | Focus color of the navigation filter input. | |
| 18.75rem (default) / 17rem (scale=sm) / 21rem (scale=lg) | Width of the navigation bar. | |
| 0.4375rem 1rem 0.4375rem 0.625rem (nav-item-spacing sets compact/relaxed) | Padding of navigation items. | |
| 60px | Maximum height of the nav-logo slot. |
Typography
Font families, sizes, and the heading scale shared by RapiDoc headings and markdown descriptions.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif | Font for text, headings, and navigation (shadcn/ui token). | |
| ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Roboto Mono', monospace | Font for code, HTTP methods, paths, and schemas (shadcn/ui token). | |
| 11px (default) / 11px (scale=sm) / 12px (scale=lg) | Smallest text and the size floor: badges, method tags in the sidebar, oneOf/anyOf chips, constraint labels, tiny buttons. | |
| 12px (default) / 11px (scale=sm) / 14px (scale=lg) | Small text: parameter names and types, schema trees, tabs, labels. | |
| 13px (default) / 12px (scale=sm) / 15px (scale=lg) | Short prose next to data: parameter, property, and response-header descriptions. | |
| 13px (default) / 12px (scale=sm) / 15px (scale=lg) | Code blocks and monospace text. | |
| 14px (default) / 13px (scale=sm) / 16px (scale=lg) | Body text and descriptions. | |
| 1.6 | Line height of paragraphs and list items in descriptions. | |
| 1em | Space between consecutive paragraphs in descriptions. | |
| var(--font-sans) | Font of headings. | |
| 600 | Font weight of headings. | |
| 1.25 | Line height of headings. | |
| normal | Letter spacing of headings. | |
| var(--foreground) | Text color of headings. | |
| 1.5em | Space above a heading (0 for the first element in a section). | |
| 0.5em | Space below a heading. | |
| 2rem | h1: the API title. | |
| 1.5rem | h2: tags and top-level sections. | |
| 1.25rem | h3: operation summaries. | |
| 1rem | h4. | |
| 0.875rem | h5. | |
| 0.8125rem | h6. | |
| var(--font-size-small) | Small upper-case label headings (Path parameters, Request body, ...). |
Layout & Geometry
Corner radius and sizing.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| 0.25rem (radius attribute: none, sm, md, lg, full) | Corner radius of buttons, inputs, badges; cards and dialogs use min(var(--radius), 0.5rem) (shadcn/ui token). | |
| 400px | Maximum height of response and multi-line text areas. | |
| 240px | Width of the property-name column in table schema style. | |
| ellipsis | text-overflow of long property names in table schema style. | |
| nowrap | white-space of property names in table schema style. | |
| 12rem | Width of the label column (name and type) in parameter lists. | |
| 0.5rem | Space between the columns of a parameter list. | |
| 0.25rem | Space between the rows inside one parameter (input or constraints, then details). | |
| 0.5rem | Padding inside each parameter of a parameter list. | |
| 0.375rem | Space on each side of the separator between values (Allowed values, Examples). | |
| 0.125rem | Space between wrapped lines of a value list. | |
| 0.25rem | Space between a value list label and its first value. | |
| 0.75rem | Padding inside each security scheme; OAuth flows are indented four times this. | |
| 120px | Space kept above a section when navigation scrolls to it; set it to your sticky header height. |
HTTP Methods
Colors of method badges, operation borders, and navigation method labels.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| #5c98f9 (dark) / #2563eb (light) | GET. | |
| #68cc97 (dark) / #047857 (light) | POST. | |
| #f59e0b (dark) / #c2410c (light) | PUT. | |
| #f75252 (dark) / #b91c1c (light) | DELETE. | |
| #a78bfa (dark) / #7c3aed (light) | PATCH. | |
| #eab308 (dark) / #b45309 (light) | HEAD. | |
| #06b6d4 (dark) / #0e7490 (light) | OPTIONS. | |
| #ec4899 (dark) / #be185d (light) | TRACE. | |
| #818cf8 (dark) / #4f46e5 (light) | QUERY. | |
| #64748b (dark) / #475569 (light) | Any other method (COPY, PURGE, ...). | |
| #000000 (dark) / #ffffff (light) | Text on filled method badges in the navigation. |
Named Colors
Palette referenced by name from x-badges (color: blue, green, ...) and used for links and status text.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| #3b82f6 (dark) / #2768f4 (light) | Blue; also link color. | |
| #10b981 (dark) / #059669 (light) | Green. | |
| #f59e0b (dark) / #d97706 (light) | Orange. | |
| #ef4444 (dark) / #dc2626 (light) | Red (badges only; errors use --destructive). | |
| #8b5cf6 (dark) / #7c3aed (light) | Purple. | |
| #eab308 (dark) / #b45309 (light) | Yellow. | |
| #ec4899 (dark) / #db2777 (light) | Pink. | |
| #d97706 (dark) / #92400e (light) | Brown. |
Code & Syntax Highlighting
Code block background and syntax token colors.
| Custom Property | Default / Calculated Value | Description & Purpose |
|---|---|---|
| var(--input-background) (dark) / --background with 4% --foreground (light) | Background of code blocks and examples. | |
| slightly darker than --background (dark) / var(--background) (light) | Background of form fields. | |
| #8b949e (dark) / #6e7781 (light) | Comments. | |
| #ff7b72 (dark) / #cf222e (light) | Keywords. | |
| #c9d1d9 (dark) / #24292f (light) | Operators and punctuation. | |
| #a5d6ff (dark) / #0a3069 (light) | String literals. | |
| #79c0ff (dark) / #0550ae (light) | Numbers, booleans, constants. | |
| #d2a8ff (dark) / #8250df (light) | Function names. | |
| #d2a8ff (dark) / #8250df (light) | Type names. | |
| #ffa657 (dark) / #953800 (light) | Variables. | |
| #79c0ff (dark) / #0550ae (light) | Object keys and properties. | |
| #7ee787 (dark) / #116329 (light) | Markup tags. | |
| #d2a8ff (dark) / #8250df (light) | CSS selectors. | |
| #7ee787 (dark) / #116329 (light) | Inserted lines in diffs. | |
| #ff7b72 (dark) / #cf222e (light) | Deleted lines in diffs. |
2. CSS Shadow Parts (120)
Navigation Sidebar
Parts for customizing the sidebar navigation panel, filter inputs, and route links.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <nav> | Outer navigation sidebar container. | |
| <div> | Header wrapper container inside the sidebar encapsulating the nav logo slot and filter search container. | |
| <slot> | Slot container for the brand logo or custom header inside the navigation bar. | |
| <button> | Mobile hamburger toggle button to open or collapse the navigation sidebar. | |
| <div> | Container wrapping the filter search input inside the navigation sidebar. | |
| <input> | Text input element used for real-time search filtering in the sidebar. | |
| <button> | Clear button inside the sidebar search input. | |
| <div> | Scrollable inner container holding all tags, endpoints, and markdown headings. | |
| <div> | Base part applied to every clickable item in the navigation sidebar. | |
| <div> | Sidebar item pointing to the API Overview section. | |
| <div> | Sidebar item pointing to the API Servers section. | |
| <div> | Sidebar item pointing to the Authentication section. | |
| <div> | Sidebar item pointing to the top of the operations list. | |
| <div> | Sidebar item representing an OpenAPI tag heading. | |
| <div> | Sidebar item representing an individual endpoint operation (e.g., GET /users). | |
| <div> | Added to the sidebar item of the section in view (operation, tag, overview, servers, authentication), and moved as the reader navigates. Style it to highlight the whole active row, e.g. rapi-doc::part(section-navbar-active-item) { background-color: #E2000F; color: #fff; }. |
Header & Branding
Parts for the top utility header, logo slot, and dynamic spec loader.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <header> | Top utility header bar container. | |
| <slot> | Slot container for the brand logo or icon. | |
| <div> | Title text displayed in the header bar. | |
| <input> | Input field for entering an OpenAPI specification URL dynamically. | |
| <input> | Search filter input in the header bar. |
Main Canvas & Overview
Parts for the primary document canvas, spec title, and info anchors.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <main> | The primary scrollable document canvas wrapper. | |
| <p> | The hint shown when the element has no spec: no spec-url and nothing loading. Fades in after 1.5s, so a spec loaded from script (loadSpec, or a rapi-flow with its URL box) never shows it. | |
| <div> | Top introductory overview section containing API metadata, description, and contact info. | |
| <h1> | The main API title heading inside the overview section. | |
| <span> | API version badge inside the overview title. | |
| <a> | Contact email, license, and terms of service links in the overview. |
Servers & Environments
Parts for server environment controls, selection, and URL variable templates.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <div> | Container for server selection and environment controls. | |
| <h2> | Title heading for the API Servers section. | |
| <div> | Label displaying the currently selected base server URL. | |
| <input> | Input fields for server URL template variables. |
Authentication & Security
Parts for authentication credentials, OAuth2 scopes, and security modals.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <div> | Container for authentication credentials and security scheme panels. | |
| <h2> | Title heading for the Authentication section. | |
| <ul> | List of security schemes (replaces the v11 `#auth-table` table). | |
| <li> | One security scheme; also has the class of its type (`apikey`, `http`, `oauth2`, …). | |
| <div> | OAuth2 flows inside their security scheme. | |
| <div> | Wrapper for OAuth2 authorization scope options. | |
| <input type='checkbox'> | Checkbox for selecting individual OAuth2 permission scopes. | |
| <input> | Input field for the OAuth2 client ID. | |
| <input> | Input field for the OAuth2 client secret. | |
| <input> | Username input field for HTTP Basic or password authentication. | |
| <input> | Password input field for HTTP Basic or password authentication. |
Operations & Endpoints
Parts for endpoint headers, method badges, paths, summaries, and dividers.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <section> | Tag group container grouping multiple related operations. | |
| <h2> | Header title displayed for an OpenAPI tag. | |
| <h2> | Text label for the tag title. | |
| <div> | A tag's description in <rapi-doc-mini> with show-tags="true", indented to line up with the method badges. | |
| <section> | Container wrapping all operations belonging to a tag. | |
| <article> | Single endpoint operation container. | |
| <div> | Tag badge/indicator rendered within the operation header. | |
| <div> | Container holding both the request configuration and response viewing panels. | |
| <div> | Panel containing request parameters, headers, and payload inputs. | |
| <h4> | The Request label heading of an operation (<h6> inside callbacks). | |
| <h4> | The Response label heading of an operation (<h6> inside callbacks). | |
| <h3> | Summary heading for the operation. | |
| <span> | HTTP method label badge (e.g., GET, POST, PUT, DELETE). | |
| <span> | Endpoint URI route path. | |
| <span> | Status badge on endpoint (e.g., deprecated, webhook). | |
| <div> | Horizontal divider separating operations in read mode. | |
| <div> | Header row of an expanded endpoint in view or focused mode. | |
| <div> | Header row of a collapsed endpoint in view mode. | |
| <div> | HTTP method badge in the endpoint header row. | |
| <div> | Path text in the endpoint header row. | |
| <div> | Short summary description in the endpoint header row. | |
| <div> | Full body container of an expanded endpoint. | |
| <div> | Body container when an endpoint is collapsed. | |
| <h3> | Summary title inside the expanded endpoint body. | |
| <div> | Full markdown description inside the expanded endpoint body. | |
| <div> | Row of authentication chips right under the method and path (above the description); wraps onto more lines when narrow. | |
| <span> | The "Authorization" label of the operation security row. Visually hidden (it names the group for screen readers); a lock icon starts the row instead. | |
| <a> | Lock icon at the start of the operation security row; links to the Authentication section. Shown as a plain icon when authentication is not allowed. | |
| <span> | One authentication chip (e.g. "OAuth (Oauth2) + 1 more"). Hover or keyboard focus opens its details popover; it does not navigate. | |
| <div popover> | Details popover for a chip, shown on hover or keyboard focus and closed with Escape. |
Headings
Every heading RapiDoc generates (not headings inside markdown descriptions) carries these parts, so one rule can style a whole level. Outline: API title h1; servers, authentication, tag groups and tags h2; operations h3; Request/Response h4; parameter and request-body labels h5.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <h1>-<h6> | Any heading generated by RapiDoc. | |
| <h1> | Level 1: the API title. | |
| <h2> | Level 2: servers, authentication, tag groups, tags, component groups, and the tag label above an operation in focused mode. | |
| <h3> | Level 3: operation summaries, server variables, OAuth flows, and component names. | |
| <h4> | Level 4: Request, Response, Code samples, and Callbacks labels. | |
| <h5> | Level 5: parameter, request body, and response header labels; callback names. | |
| <h6> | Level 6: Callback request and Callback response labels. |
Interactive Console & Buttons
Parts for the Try console, buttons, response panels, and action triggers.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <div> | Container wrapping the Try, Clear, and Execute action buttons. | |
| <button> | Base part applied to all buttons across RapiDoc. | |
| <button> | The primary 'TRY' execution button. | |
| <button> | Solid filled buttons (e.g., primary actions, search). Also on FILL EXAMPLE; target btn-fill-example to style that button alone. | |
| <button> | The FILL EXAMPLE button, which refills request fields with the spec's examples; it is only rendered when a field has an example, and CLEAR is disabled while every field is empty. To hide both: rapi-doc::part(btn-fill-example), rapi-doc::part(btn-clear) { display: none; } | |
| <button> | Outlined secondary buttons. | |
| <button> | Button to clear request parameter fields. | |
| <button> | Button to clear returned response data. | |
| <button> | Copy-to-clipboard button on code blocks and responses. | |
| <button> | Search submit button in filter dialogues and headers. | |
| <button> | HTTP response status code selector buttons (e.g., 200, 400, 404). | |
| <button> | The currently active HTTP response status button. |
Tabs & Code Panels
Parts for switching between Request/Response tabs, Example/Schema, and languages.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <div> | Container panel wrapping tab controls and content. | |
| <div> | Row of tab selector buttons. | |
| <button> | Individual tab button. | |
| <div> | Body container of the active tab. |
Parameter Lists
Request parameters, request-body form fields, response headers, and server variables. Each list is a grid; every parameter is a subgrid row, so columns line up across rows.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <ul> | The list; a three-column grid (label, input, constraints). Stacks into one column on narrow widths. | |
| <li> | One parameter; draws its own full-width border. Has the `deprecated` class when deprecated. | |
| <div> | First column: name and type. | |
| <div> | Parameter name, with the required marker and deprecated icon. | |
| <div> | Parameter type or format. | |
| <div> | Try-it input (only with `allow-try="true"`, plus object form fields and server variables). Spans both right-hand columns when there are no constraints. | |
| <dl> | Constraints as label/value pairs (Default, Pattern, Limits, Allowed, or a response header Example). The labels share one column, so all values start at the same place. | |
| <dt> | A constraint label ("Default:", "Pattern:", "Limits:", "Allowed:"). | |
| <div> | Description and examples, under the input and constraints. | |
| <ul> | Long-format examples (with a summary or description); one entry per example, each with a thin left rule. | |
| <div> | A label with a wrapping list of values (Allowed values, short-format Examples). Wrapped lines line up under the first value. | |
| <span> | The label of a value list ("Allowed:", "Examples:"). | |
| <ul> | The values; separators between them are drawn in CSS and stay at the end of a line. |
Inputs & Form Fields
Parts for parameter inputs, textareas, file pickers, and checkboxes.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <input> | Standard text input field. | |
| <input> | Input field for query, path, and header parameters. | |
| <textarea> | Standard multi-line text input field. | |
| <textarea> | Multi-line text input for request bodies and payload parameters. | |
| <input type='file'> | File upload input element for multipart forms. | |
| <input type='checkbox'> | Standard checkbox input. | |
| <a> | General links throughout the documentation. | |
| <button> | Example value chip; clicking it fills the parameter input. | |
| <button> | Allowed (enum) value chip; clicking it fills the parameter input. |
Schema & Data Types
Parts for schema descriptions, tree toolbars, and badges.
Part Name (::part) | HTML Element | Description & Purpose |
|---|---|---|
| <span> | Markdown description text inside schema definitions. | |
| <div> | Controls on schema cards (expand, collapse, view options). | |
| <div> | Toggle button to expand or collapse multi-line descriptions. |
Semantic Headings
RapiDoc renders real <h1>–<h6> headings, so its output reads like the rest of your docs and blends with Markdown/MDX pages: the API title is h1; servers, authentication, tag groups and tags areh2; operations are h3; Request/Response are h4; parameter labels are h5. Headings inside your Markdown descriptions share the same scale. Match your site's type scale with the heading tokens, or style every generated heading of a level with the heading-1…heading-6 parts.
rapi-doc {
--heading-weight: 600;
--heading-line-height: 1.2;
--line-height: 1.75;
--h1-font-size: 2.25rem;
--h2-font-size: 1.75rem;
--h3-font-size: 1.375rem;
}
rapi-doc::part(heading-2) {
border-bottom: 1px solid #334155;
padding-bottom: 0.25em;
}