Customization Introduction
Customizing your documentation allows you to create a unique and branded experience for your users. There are three main approaches for customization:
-
Customization via settings file - choose from a variety of pre-built themes and tweak using available theme settings
-
Extending the default theme - build upon the existing design while adding your own enhancements via code
-
Creating a new theme - develop a completely new theme from scratch via code
Customization via Settings File
This is the simplest way to customize your documentation.
You can do this by editing the docs.json file in the root of your project.
For more details on the theme settings, see the reference guide.
Customization via Code
To customize your documentation via code, you'll need to work with a .docs/theme directory inside your project root:
theme/index.css
You can customize theme styles via index.css:
theme/index.tsExperimental
xyd will lookup for index.ts if you want to modify or create new theme behavior.
This file is only necessary when you need to extend default theme's functionality or create a new theme:
However, if you only want to customize styles, you can simply use index.css without creating an index.ts file.
Learn more about extending the default theme or creating a custom theme via code.
Theme Reference
Theme settings are defined as an object with the following reference:
name"poetry" | "cosmo" | "opener" | "picasso" | "gusto" | "solar" | "terrarium" | stringRequired
A theme name.logo
Path to logo image or object with path to "light" and "dark" mode logo images, and where the logo links to.LogoLogo
Logo configuration interfacelightstring
Path to the logo in light mode. For example: `/path/to/logo.svg`darkstring
Path to the logo in dark mode. For example: `/path/to/logo.svg`altstring
Alternative text for the logo image. The logo is the only content of the link to the home page, so this doubles as that link's accessible name. Defaults to `seo.metatags["og:site_name"]` , then to `"Home"` .hrefstring
External href to when clicking on the logopagestring
The page to link to when clicking on the logo
stringstring
React.JSX.ElementReact.JSX.Element
fontsThemeFont
Font configuration for the theme.FontFont
familystring
The font family to use.weightstring
The font weight to use.srcstring
The font src to use.format"woff2" | "woff" | "ttf"
The font format to use.
Font[]Font[]
faviconstring
Path to the favicon image. For example: /path/to/favicon.svgiconsIcons
The iconify library setup.library
The iconify libraryIconLibraryIconLibrary
namestringRequired
The iconify library nameversionstring
The iconify library versiondefaultboolean
The default iconify icon namenoprefixboolean
Merge icons from the library into the default iconify library
stringstring
IconLibrary[]IconLibrary[]
appearanceAppearance
Appearance configuration for the theme.colorScheme"light" | "dark" | "os"
The default color scheme to use.colorSchemeButton
If `false` then the color scheme button will not be displayed.colorsColors
Colors configuration for the theme.primarystringRequired
The primary color of the theme.lightstring
The light color of the theme.darkstring
The dark color of the theme.
cssTokens
CSS tokens for the theme.presetsstring[]
Presets for the theme.logoAppearanceLogo
Logo appearance for the theme.sidebarboolean | "mobile" | "desktop"
If `true` then the logo will be displayed on the sidebar.headerboolean | "mobile" | "desktop"
If `true` then the logo will be displayed on the header.
searchAppearanceSearch
Search appearance for the theme.fullWidthboolean
If `true` then the search bar will be displayed as a full width.sidebarboolean | "mobile" | "desktop"
If `true` then the search bar will be displayed on the sidebar.middleboolean | "mobile" | "desktop"
If `true` then the search bar will be displayed in the middle of the header.rightboolean | "mobile" | "desktop"
If `true` then the search bar will be displayed on the right side of the header.
headerAppearanceHeader
Header appearance for the theme.externalArrowboolean
If `true` then the header external links will display an external arrow.separator"right"
If `right` then separator will be displayed on the right side of the header.type"classic" | "pad"
The type of the header.buttonSize"sm" | "md" | "lg"
The button size of the header.
tabsAppearanceTabs
Tabs appearance for the theme.surface"center" | "sidebar"
The tabs to display in the header.
sidebarAppearanceSidebar
Sidebar appearance for the theme.externalArrowboolean
If `true` then the sidebar will display a scroll shadow.scrollShadowboolean
If `true` then the sidebar will display a scroll shadow.scrollbar"secondary"
The color of the sidebar scrollbar.scrollbarColorstring
The color of the sidebar scrollbar.scrollTransition"smooth" | "instant"
The transition behaviour of the sidebar scroll when navigating to a new page.groupCase"none" | "uppercase"
Letter-casing of sidebar group headers. Defaults to `"uppercase"` ; set `"none"` to render group labels exactly as authored.scroll"sidebar" | "list"
Which element scrolls. `"list"` (default): only the item list scrolls, below the fixed (pinned) region. `"sidebar"` : the WHOLE sidebar scrolls — the scrollbar spans its full height — and the fixed region sticks to the top while items scroll beneath it.
buttonsAppearanceButtons
Buttons appearance for the theme.roundedboolean | "sm" | "md" | "lg"
tablesAppearanceTables
Table appearance for the theme.kind"secondary"
The kind of the table.
bannerAppearanceBanner
Banner appearance for the theme.fixedboolean
If `true` then the banner will have fixed position (always visible).
contentAppearanceContent
Content appearance for the theme.contentDecorator"secondary"
Content decorator for the theme.breadcrumbs
Controls the breadcrumbs. `true` / `false` toggles them; an object ( AppearanceBreadcrumbs ) additionally configures `links` and `rootLevel` (both default `true` ).AppearanceBreadcrumbsAppearanceBreadcrumbs
Fine-grained breadcrumbs options (the object form of AppearanceContent.breadcrumbs ).linksboolean
If `true` (default) breadcrumb items that resolve to a real route render as clickable links; if `false` every crumb is plain text.rootLevelboolean
If `true` (default) the top-level segment (the tab/route the page belongs to, e.g. "Guides") is included; if `false` it is omitted.
booleanboolean
sectionSeparatorboolean
If `true` then the section separator will be displayed.
footerAppearanceFooter
Footer appearance for the theme.surface"page"
The footer surface.
navigationDropdownAppearanceNavigationDropdown
Navigation dropdown appearance (header anchors & tabs `dropdownMenu` ).chevron"rotate" | "static"
Trigger chevron behavior when the menu is open. `"rotate"` (default) flips the chevron; `"static"` leaves it unchanged.items"padded" | "flush"
Menu item layout. `"flush"` makes the hovered item background touch all four edges of the popover (no surrounding padding); `"padded"` (default) keeps a small inset with rounded item corners.
writerWriter
Writer configuration for the theme.maxTocDepthnumber
The maximum number of table of conten§ts levels.copyPageboolean
Copy page button
coderCoder
Coder configuration for the theme, including options like syntax highlighting.linesboolean
If `true` then code blocks will have line numbers by default.scrollboolean
If `true` then code blocks will have a scrollbar by default.syntaxHighlightTheme
Syntax highlighting configuration.
headarray of HeadConfig [string, Record<string, string | boolean>, ]
Configuration type for head elements that can be added to the HTML head. Format: [tagName, attributes, content] @example: ['script', { src: 'https://example.com/script.js', defer: true }]scriptsstring[]
Custom scripts to be added to the head of the every page. Paths are relative to the root of the project or absolute.
Full settings reference you can read here.
Show your support! Star us on GitHub ⭐️