Getting Started
Getting Started
Learn how to add the view modes to your documentation website with the Starlight View Modes plugin.
A Starlight plugin adding different view mode capabilities to your documentation website.
- Zen Mode to read pages without distractions.
- Presentation Mode to present pages as slide decks.
- Keyboard shortcuts to switch between view modes.
- View modes data to build custom view mode switchers.
- Multilingual support for all view modes.
Prerequisites
You will need to have a Starlight website set up. If you don’t have one yet, you can follow the “Getting Started” guide in the Starlight docs to create one.
Installation2/2
-
Configure the plugin in your Starlight configuration in the
astro.config.mjsfile.astro.config.mjs import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightViewModes from 'starlight-view-modes'export default defineConfig({integrations: [starlight({plugins: [starlightViewModes()],title: 'My Docs',}),],}) -
Start the development server to see the plugin in action.
The Starlight View Modes plugin behavior can be tweaked using various configuration options.
Component overrides
The Starlight View Modes plugin uses a Starlight component override for the PageTitle, Search, SocialIcons, and TableOfContents components.
If you have a custom PageTitle component override in your Starlight project, you will need to manually render the PageTitle component from the Starlight View Modes plugin in your custom component:
---import Default from '@astrojs/starlight/components/PageTitle.astro'import StarlightViewModesPageTitle from 'starlight-view-modes/components/PageTitle.astro'---
<Default><slot /></Default><p>Custom content in the PageTitle override</p><StarlightViewModesPageTitle />The same logic applies to the Search, SocialIcons and TableOfContents components.