diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts
index 18da1b9d35d1..9e9c5a8f2075 100644
--- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts
+++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts
@@ -691,6 +691,16 @@ declare module '@theme/Navbar/MobileSidebar/Header' {
export default function NavbarMobileSidebarHeader(): JSX.Element;
}
+declare module '@theme/Navbar/Search' {
+ import type {ReactNode} from 'react';
+
+ export interface Props {
+ readonly children: ReactNode;
+ }
+
+ export default function NavbarSearch(props: Props): JSX.Element;
+}
+
declare module '@theme/NavbarItem/DefaultNavbarItem' {
import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx
index a71cd478fa02..9ab92085eca5 100644
--- a/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx
+++ b/packages/docusaurus-theme-classic/src/theme/Navbar/Content/index.tsx
@@ -17,6 +17,7 @@ import {
} from '@docusaurus/theme-common';
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
import NavbarLogo from '@theme/Navbar/Logo';
+import NavbarSearch from '@theme/Navbar/Search';
import styles from './styles.module.css';
function useNavbarItems() {
@@ -73,7 +74,11 @@ export default function NavbarContent(): JSX.Element {
<>
- {autoAddSearchBar && }
+ {autoAddSearchBar && (
+
+
+
+ )}
>
}
/>
diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/Search/index.tsx b/packages/docusaurus-theme-classic/src/theme/Navbar/Search/index.tsx
new file mode 100644
index 000000000000..8d3fe1b19d2f
--- /dev/null
+++ b/packages/docusaurus-theme-classic/src/theme/Navbar/Search/index.tsx
@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+import React from 'react';
+import type {Props} from '@theme/Navbar/Search';
+
+import styles from './styles.module.css';
+
+export default function NavbarSearch({children}: Props): JSX.Element {
+ return
{children}
;
+}
diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/styles.module.css b/packages/docusaurus-theme-classic/src/theme/Navbar/Search/styles.module.css
similarity index 100%
rename from packages/docusaurus-theme-search-algolia/src/theme/SearchBar/styles.module.css
rename to packages/docusaurus-theme-classic/src/theme/Navbar/Search/styles.module.css
diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx
index 5a779eebdb27..dfefa83dc154 100644
--- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx
+++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/SearchNavbarItem.tsx
@@ -8,11 +8,16 @@
import React from 'react';
import type {Props} from '@theme/NavbarItem/SearchNavbarItem';
import SearchBar from '@theme/SearchBar';
+import NavbarSearch from '@theme/Navbar/Search';
export default function SearchNavbarItem({mobile}: Props): JSX.Element | null {
if (mobile) {
return null;
}
- return ;
+ return (
+
+
+
+ );
}
diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx
index 9c6706c055cb..864bac42add3 100644
--- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx
+++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx
@@ -17,7 +17,6 @@ import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
import type {SearchClient} from 'algoliasearch/lite';
import {useAlgoliaContextualFacetFilters} from '@docusaurus/theme-search-algolia/client';
import Translate, {translate} from '@docusaurus/Translate';
-import styles from './styles.module.css';
import type {
DocSearchModal as DocSearchModalType,
@@ -233,19 +232,17 @@ function DocSearch({
/>
-
-
-
+
{isOpen &&
DocSearchModal &&