Aller au contenu

Configuration

Ce contenu n’est pas encore disponible dans votre langue.

All configuration options are optional. The plugin works out of the box with sensible defaults.

astro.config.mjs
starlightTelescope({
shortcut: { /* keyboard shortcut config */ },
fuseOptions: { /* search algorithm config */ },
recentPagesCount: 5,
maxResults: 20,
debounceMs: 100,
theme: { /* color customization */ },
})
OptionTypeDefaultDescription
shortcutobjectSee belowKeyboard shortcut to open modal
fuseOptionsobjectSee belowFuse.js search configuration
recentPagesCountnumber5Recent pages to display (0-20)
maxResultsnumber20Maximum search results to display (1-100)
debounceMsnumber100Search debounce delay (0-1000ms)
themeobject{}Theme color overrides

Configure the keyboard shortcut to open the search modal.

PropertyTypeDefaultDescription
keystring'/'The key to press
ctrlbooleantrueRequire Ctrl key
metabooleantrueRequire Meta/Cmd key (Mac)
shiftbooleanfalseRequire Shift key
altbooleanfalseRequire Alt key

The default shortcut is Ctrl+/ on Windows/Linux and Cmd+/ on Mac.

shortcut: { key: 'k', ctrl: true, meta: true }

Configure Fuse.js fuzzy search behavior.

PropertyTypeDefaultDescription
thresholdnumber0.3Match threshold (0 = exact, 1 = match all)
ignoreLocationbooleantrueIgnore where match occurs in string
distancenumber100Max distance for fuzzy matches
minMatchCharLengthnumber2Minimum characters to trigger match
findAllMatchesbooleanfalseContinue searching after first match
keysarraySee belowFields to search with weights
keys: [
{ name: 'title', weight: 1.0 },
{ name: 'path', weight: 0.6 },
{ name: 'tags', weight: 0.5 },
{ name: 'description', weight: 0.3 },
]
ValueBehavior
0.0Exact matches only
0.3Minor typos allowed (default)
0.5Moderate fuzziness
0.7Very lenient matching
fuseOptions: {
threshold: 0.4,
keys: [
{ name: 'title', weight: 1.0 },
{ name: 'description', weight: 0.8 },
{ name: 'path', weight: 0.3 },
],
}

Number of recently visited pages to display. Set to 0 to disable the feature.

recentPagesCount: 10 // Show last 10 pages
recentPagesCount: 0 // Disable recent pages

Maximum number of search results to display at once. This improves performance on large documentation sites by limiting DOM rendering. When there are more results than the limit, a message indicates how many total results were found.

maxResults: 30 // Show up to 30 results
maxResults: 50 // For larger monitors or power users

Milliseconds to wait after typing before searching. Higher values reduce CPU usage on slower devices.

debounceMs: 200 // Wait 200ms after typing stops

Customize colors using CSS color values. All properties are optional and inherit from Starlight’s design tokens by default.

PropertyCSS VariableInherits From
overlayBackground--telescope-overlay-bg--sl-color-backdrop-overlay
modalBackground--telescope-modal-bg--sl-color-bg-nav
modalBackgroundAlt--telescope-modal-bg-alt--sl-color-bg
accentColor--telescope-accent--sl-color-accent
accentHover--telescope-accent-hoverDerived from accent
accentSelected--telescope-accent-selectedDerived from accent
textPrimary--telescope-text-primary--sl-color-white
textSecondary--telescope-text-secondary--sl-color-gray-3
border--telescope-border--sl-color-hairline-light
borderActive--telescope-border-active--sl-color-gray-5
pinColor--telescope-pin-color--sl-color-purple
tagColor--telescope-tag-color--sl-color-green
theme: {
accentColor: '#a855f7',
accentHover: 'rgba(168, 85, 247, 0.1)',
accentSelected: 'rgba(168, 85, 247, 0.15)',
pinColor: '#ec4899',
}

See the Styling Guide for more theming options.

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightTelescope from 'starlight-telescope'
export default defineConfig({
integrations: [
starlight({
plugins: [
starlightTelescope({
shortcut: { key: 'k', ctrl: true, meta: true },
fuseOptions: {
threshold: 0.4,
keys: [
{ name: 'title', weight: 1.0 },
{ name: 'description', weight: 0.5 },
],
},
recentPagesCount: 8,
maxResults: 25,
debounceMs: 150,
theme: {
accentColor: '#7c3aed',
pinColor: '#f59e0b',
},
}),
],
title: 'My Docs',
}),
],
})