---
id: examples
title: Examples and extensions
description: Live demos showing how to use and extend DocSearch beyond documentation-only use cases.
---
import { DocSearch } from '@docsearch/react';
import { DocSearch as DocSearchProvider } from '@docsearch/core';
import { DocSearchButton, DocSearchModal } from '@docsearch/modal';
import { DocSearchSidepanel } from '@docsearch/react/sidepanel';
import BrowserOnly from '@docusaurus/BrowserOnly';
import '@docsearch/css/dist/style.css';
import '@docsearch/css/dist/sidepanel.css';
> These examples are interactive. Click a button to open the modal and try a query.
## Basic keyword search
Use the default experience with your index credentials. This works great for typical docs, blogs, and any site with a DocSearch-compliant index.
```jsx
```
---
## Ask AI: ai-assisted answers
Add Algolia Ask AI to get synthesized answers grounded in your indexed content. You can scope the LLM context using `searchParameters` like `facetFilters`, `filters`, `attributesToRetrieve`,`restrictSearchableAttributes`, and `distinct`.
```jsx
```
---
## Sidepanel: persistent AI chat
The sidepanel provides a persistent chat interface anchored to the side of the page, ideal for documentation sites where users want to ask follow-up questions without losing their place. Look for the button on the bottom right of the screen to try the demo.
```jsx
```
{() => (
)}
---
## Composable API: DocSearchButton + DocSearchModal
Use the [Composable API](/docs/composable-api) to render the button and modal as separate components. This gives you explicit control over where each piece is rendered and when the modal code is loaded.
```jsx
import { DocSearch } from '@docsearch/core';
import { DocSearchButton, DocSearchModal } from '@docsearch/modal';
import '@docsearch/css/style.css';
;
```
{() => (
)}
---
## Custom hit rendering (`hitComponent`)
Replace the default hit markup to match your brand and layout. Below is a minimal example of a custom component.
```jsx
function CustomHit({ hit }) {
// render a compact, branded hit card
return (