Customization
Theme options
Section titled “Theme options”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.
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.
Fluent theme tokens
Section titled “Fluent theme tokens”The theme declares these additional CSS custom properties. Defaults shown here are the base theme values; presets and theme-specific rules can override them.
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.
Custom CSS
Section titled “Custom CSS”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.
Translations
Section titled “Translations”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:
{ "starlightFluent.header.settings": "Preferences", "starlightFluent.sidebarFilter.label": "Search pages"}Cascade layers
Section titled “Cascade layers”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:
@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.