Last updated 1 month ago

Theming options for Reference docs

NOTE: Redoc doesn’t load any fonts by default so you have take care of it yourself.

To customize the style of your API documentation, specify the theming options in the referenceDocs > theme object. This applies regardless of your preferred Reference docs usage method. If you're using our Workflows/hosted service or our CLI for on-premise deployments, we recommend specifying the theming options in a .redocly.yaml configuration file.

Expand the theme schema below to show all available theming options. Options supported in Redoc Community Edition (the free and open source version of the product) are marked to distinguish them from options supported only in the premium version of the product.

referenceDocs > theme schema

object

Breakpoints for switching three/two and mobile view layouts. Supported in Redoc CE.

object

Controls the appearance of code samples in the right panel.

object

Supported in Redoc CE.

object

Supported in Redoc CE.

object

Allows overriding default styling of specific elements with custom CSS.

object

Supported in Redoc CE.

object
object
object

Supported in Redoc CE.

object

Controls the spacing of items and sections in the generated API documentation. The numbers set here are used to calculate the final positioning values. Supported in Redoc CE.

object

Controls the appearance of the Try it button.

object

Supported in Redoc CE.

Example theme

Add your custom theme settings to the referenceDocs > theme section of the .redocly.yaml configuration file.

When using Redocly CLI, you can pass one or more theming options to the CLI tool with the --options parameter. To make it more practical, you can also save your custom theme as a JSON file and pass it to the CLI tool with the same parameter, like in the following example:

reference-docs build example-openapi.yaml --options=theme.json

Example theme.json file

referenceDocs:
  theme: {
    overrides: {
      DownloadButton: {
        custom: `
          background-color: green;
          color: white;
          &:hover {
            color: red;
          }
        // ...
        `,
      }
    },
    typography: {
      heading1: {
        transform: 'uppercase',
        },
      rightPanelHeading: {
        transform: 'uppercase'
        },
      fieldName: {
        fontWeight: 'bold'
        }
     }
    }