> For the complete documentation index, see [llms.txt](https://search.docs.reactify.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://search.docs.reactify.com.au/components/suggestions.md).

# Suggestions

### Purpose

The Suggestions component is used to display a list of "did you mean" style suggestions within an instant search or similar area.

### Usage

{% tabs %}
{% tab title="Basic" %}

```tsx
import React from "react";
import { Suggestions } from "@usereactify/search";

import { ExampleSuggestions } from "./ExampleSuggestions";

export const Component: React.FC = () => {
  return (
    <Suggestions
      field="title"
      render={ExampleSuggestions}
    />
  );
};
```

{% endtab %}

{% tab title="ExampleSuggestions" %}

```tsx
import React from "react";

import { SuggestionsProps, useSearch } from "@usereactify/search";

export type ExampleSuggestionsProps = React.ComponentProps<
  NonNullable<SuggestionsProps["render"]>
>;

export const ExampleSuggestions: React.FC<ExampleSuggestionsProps> = (
  props
) => {
  const { setSearchTerm } = useSearch();

  return (
    <>
      <h3>Suggestions</h3>
      <ul>
        {props.suggestions.map((suggestion) => (
          <li onClick={() => setSearchTerm(suggestion.text)}>
            {suggestion.text}
          </li>
        ))}
      </ul>
    </>
  );
};

```

{% endtab %}
{% endtabs %}

### Props

```typescript
type SuggestionsProps = {
  /** The field which should be used for suggestions */
  field: "title";
  /** Render method */
  render?: React.FC<{
    suggestions: Array<{
      text: string;
    }>;
  }>;
};
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://search.docs.reactify.com.au/components/suggestions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
