Docs

Styling contract

Every hook the components emit, and what your CSS must do with it.

Open Markdown

proa_docs_build lowers authored components into HTML carrying stable class and data- hooks. proa_docs ships a default theme for all of them, so you do not have to write any of this to get a working site.

src/layouts/docs.rs
use proa_docs::DocsAssets;

html_sync! {
    <head>
        {DocsAssets::new()}
    </head>
}

Read on when you want to change how it looks.

Theming without replacing anything

Every colour in the default theme comes from 15 custom properties scoped to .proa-docs-body, the class DocsShell puts on its root. Override them and every component follows:

app.css
.proa-docs-body {
  --docs-bg: #fbfbfa;
  --docs-fg: #18181b;
  --docs-accent: #ff6a13;
  --docs-line: rgba(24, 24, 27, 0.12);
}

.dark .proa-docs-body {
  --docs-bg: #0b0b0d;
  --docs-fg: #f4f4f5;
}

That is the whole theming API. Reach for the hooks below only when you need to change layout or structure, not colour.

Replacing the theme

Ship your own CSS instead of DEFAULT_STYLESHEET and target the hooks in this page. They are part of the public API: they will not change without a major version.

Two rules make a replacement theme work:

What needs JavaScript

Almost nothing. DEFAULT_SCRIPT wires two things and both degrade cleanly:

HookBehaviourWithout the script
[data-code-copy]Copies the enclosing [data-code-block]Button renders, does nothing
[data-docs-copy-markdown]Fetches [data-docs-markdown-src] and copies itButton renders, does nothing

Everything else — tabs, accordions, the code explorer, steps, callouts, file trees — is CSS-only and works with JavaScript disabled.

Syntax highlighting

Highlighted tokens carry semantic hl-* classes rather than inline colours, so your stylesheet owns the palette:

app.css
.proa-docs-body .hl-keyword { color: #c678dd; }
.proa-docs-body .hl-string  { color: #98c379; }
.proa-docs-body .hl-comment { color: #7f848e; font-style: italic; }

A block that failed to highlight still renders as escaped source text with no hl-* classes, so unknown languages degrade to plain code.

The hooks

Generated from the component sources. Each is stable within a major version.

Accordions

HookKind
.proa-docs-accordionclass
.proa-docs-accordion-bodyclass
.proa-docs-accordion-titleclass
.proa-docs-accordionsclass

Callout

HookKind
.proa-docs-calloutclass
.proa-docs-callout-bodyclass
.proa-docs-callout-iconclass
[data-type]attribute

Code Block

HookKind
.proa-docs-code-blockclass
.proa-docs-code-file-iconclass
.proa-docs-code-filenameclass
.proa-docs-code-headerclass
[data-code-block]attribute
[data-code-copy]attribute
[data-code-file-icon]attribute
[data-code-filename]attribute
[data-code-header]attribute
[data-code-highlight]attribute
[data-code-icon]attribute
[data-code-line]attribute
[data-code-lines]attribute
[data-filename]attribute
[data-highlighted-line]attribute
[data-lang]attribute
[data-proa-docs-mermaid]attribute
[data-proa-docs-mermaid-output]attribute
[data-proa-docs-mermaid-source]attribute

Code Explorer

HookKind
.proa-docs-code-file-iconclass
.proa-docs-explorerclass
.proa-docs-explorer-fileclass
.proa-docs-explorer-file-nameclass
.proa-docs-explorer-pathclass
.proa-docs-explorer-path-segmentclass
.proa-docs-explorer-path-separatorclass
.proa-docs-explorer-pathsclass
.proa-docs-tabsclass
.proa-docs-tabs-listclass
.proa-docs-tabs-panelclass
.proa-docs-tabs-panelsclass
.proa-docs-tabs-radioclass
.proa-docs-tabs-tabclass
[data-code-file-icon]attribute
[data-code-icon]attribute
[data-index]attribute
[data-proa-docs-explorer]attribute

Demo

HookKind
.proa-docs-democlass
.proa-docs-demo-frameclass
.proa-docs-demo-linkclass
[data-proa-docs-demo]attribute

Files

HookKind
.proa-docs-filetreeclass
.proa-docs-filetree-iconclass
.proa-docs-filetree-indentclass
.proa-docs-filetree-rowclass
[data-kind]attribute
[data-proa-docs-filetree]attribute

Steps

HookKind
.proa-docs-stepclass
.proa-docs-stepsclass

Tabs

HookKind
.proa-docs-tabsclass
.proa-docs-tabs-listclass
.proa-docs-tabs-panelclass
.proa-docs-tabs-panelsclass
.proa-docs-tabs-radioclass
.proa-docs-tabs-tabclass
[data-index]attribute
[data-proa-docs-tabs]attribute

Type Table

HookKind
[data-proa-docs-type-table-pending]attribute

Proa Docs · Customizing the layout · Configuration

Search

Type at least 2 characters