Skip to content

Customization

Pass options when registering the Starlight plugin:

starlightFluent({
layout: {
toc: {
desktop: 'merged',
mobile: 'splitted',
position: 'right',
},
sidebar: 'normal',
corners: 'rounded',
shadows: 'content-only',
panels: 'islands',
},
features: {
sidebarFilter: true,
resizablePanels: true,
enhancedTables: true,
enhancedImages: true,
},
})

All options are optional. Omitted layout.toc properties use their own defaults, so layout: { toc: { position: 'left' } } is valid. All features default to true.

See Layout options for visual comparisons of each setting.

Option Values Default Effect
layout.toc.desktop splitted, merged splitted Separates or joins the desktop table of contents and content panels.
layout.toc.mobile splitted, merged splitted Separates or joins the mobile table of contents and content panel.
layout.toc.position left, right right Places the desktop table of contents on the selected side.
layout.sidebar normal, subtle normal Selects the standard or subdued sidebar appearance.
layout.corners squared, rounded squared Selects the default radii or larger rounded radii.
layout.shadows content-only, all, none content-only Controls layout and Starlight shadow presets.
layout.panels islands, standard islands Uses separated panel surfaces or a continuous layout with square edges and dividers.
Feature Default Effect
features.sidebarFilter true Shows the sidebar title filter.
features.resizablePanels true Adds draggable sidebar and table-of-contents resize handles.
features.enhancedTables true Enhances Markdown tables and enables their expanded dialog.
features.enhancedImages true Enables the #lightbox image dialog enhancement.

Disable a feature by setting its value to false, for example features: { enhancedImages: false }.

shadows: 'content-only' sets --fluent-layout-shadow to none; all leaves the theme’s layout shadow enabled; none sets --sl-shadow-md and --sl-shadow-lg to none. The dialog glow uses a separate token, --fluent-glow.

Options are resolved at build time and made available to theme components through Astro.locals.starlightFluent. Invalid values produce a configuration error.

The theme declares these additional CSS custom properties. Defaults shown here are the base theme values; presets and theme-specific rules can override them.

Property Base value Purpose
--fluent-layout-spacing 6px Spacing between layout panels; also the default sash width.
--fluent-layout-border-radius 6px Radius of layout panels.
--fluent-layout-shadow var(--sl-shadow-md) Shadow applied to layout panels. The default content-only preset overrides it to none.
--fluent-border-radius-sm 6px Small radius used by shared border styles.
--fluent-border-radius-lg 6px Large radius used by shared border styles.
--fluent-toc-width 18.75rem Default desktop table-of-contents width.
--fluent-sash-color var(--sl-color-text-accent) Resize handle highlight color.
--fluent-border-color var(--sl-color-gray-5) Default border color; dark mode uses var(--sl-color-gray-4).
--fluent-glow A pair of shadows based on --sl-color-white Glow used by dialog surfaces and close controls.

The rounded preset changes the small, large and layout radii to 12px, 24px and 12px, respectively. The theme also customizes Starlight’s --sl-* colors, shadows and badge variables; use Starlight’s existing variables to customize those values.

Override properties in an unlayered stylesheet registered with Starlight’s customCss. Use :root for shared values and a theme selector for a light- or dark-specific value:

:root {
--fluent-layout-spacing: 8px;
--fluent-border-radius-lg: 12px;
}
:root[data-theme='dark'] {
--fluent-border-color: #777;
}

The theme’s Sass border helpers reference these CSS properties, so overrides also apply to components styled with those helpers.

To customize the styles applied to your Starlight site when using starlight-fluent, you can provide additional CSS files to modify or extend Starlight and starlight-fluent default styles.

Learn more about custom CSS in the Starlight documentation.

All UI labels added by starlight-fluent (settings panel, sidebar filter, table and image dialogs) use Starlight’s UI translations. English is built in. To override a label or add a language, add the starlightFluent.* keys to your i18n content collection, for example:

src/content/i18n/en.json
{
"starlightFluent.header.settings": "Preferences",
"starlightFluent.sidebarFilter.label": "Search pages"
}

Like Starlight, starlight-fluent uses cascade layers internally to manage the order of its styles. This ensures a predictable CSS order and allows for simpler overrides. Any custom unlayered CSS will override the default styles from Starlight and starlight-fluent.

If you are using cascade layers, you can use @layer in your custom CSS to define the order of precedence for different layers relative to styles from the starlight and fluent layers:

src/styles/custom.css
@layer my-reset, starlight, fluent, my-overrides;

The example above defines a custom layer named my-reset, applied before all Starlight and starlight-fluent layers, and another named my-overrides, applied after all Starlight and starlight-fluent layers. Any styles in the my-overrides layer would take precedence over Starlight and starlight-fluent styles, but Starlight or starlight-fluent could still change styles set in the my-reset layer.

100%