diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 0e1eddac6eb9..bca4e7bb21d7 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -104,13 +104,15 @@ const filterText = disableQueryPersistence.value const showDetailedList = useLocalStorage( 'vitepress:local-search-detailed-list', - false + theme.value.search?.provider === 'local' && + theme.value.search.options?.detailedView === true ) const disableDetailedView = computed(() => { return ( theme.value.search?.provider === 'local' && - theme.value.search.options?.disableDetailedView === true + (theme.value.search.options?.disableDetailedView === true || + theme.value.search.options?.detailedView === false) ) }) diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index d897ae233c11..8e350a33826c 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -331,9 +331,19 @@ export namespace DefaultTheme { export interface LocalSearchOptions { /** * @default false + * @deprecated Use `detailedView: false` instead. */ disableDetailedView?: boolean + /** + * If `true`, the detailed view will be enabled by default. + * If `false`, the detailed view will be disabled. + * If `'auto'`, the detailed view will be disabled by default, but can be enabled by the user. + * + * @default 'auto' + */ + detailedView?: boolean | 'auto' + /** * @default false */