---
title: "Use the Find interface in Document Authoring"
canonical_url: "https://www.nutrient.io/guides/document-authoring/customize/find-interface/"
md_url: "https://www.nutrient.io/guides/document-authoring/customize/find-interface.md"
last_updated: "2026-08-13T00:00:00.000Z"
description: "Search a document with the Find bar in Document Authoring. Open, close, and read its state with the programmatic API, and connect Control/Command-F to custom chrome."
---

# Use the Find interface

The editor ships with a built-in Find bar for searching the current document, ready to use once the Document Authoring library is installed and running — refer to the [getting started](https://www.nutrient.io/sdk/document-authoring/getting-started.md) guide if it isn’t set up yet. This guide covers its keyboard controls, the [`editor.find`](https://www.nutrient.io/api/document-authoring/types/findnamespace/) programmatic API that drives it, and what the bar searches. The `editor.find` namespace is available from [1.19.0](https://www.nutrient.io/guides/document-authoring/changelog.md#1.19.0).

The example code omits error handling. Add it before using this code in production.

## Find behavior and keyboard controls

The Find bar is part of the editor and needs no configuration:

- Control/Command-F opens the bar and focuses its input.

- Opening the bar with Control/Command-F while text is selected presets the query with the first line of the selection.

- Enter moves to the next match, and Shift-Enter moves to the previous match. Both wrap around the end of the document.

- Escape, while the input is focused, closes the bar and returns focus to the document.

- The bar also carries previous-match, next-match, and close buttons. The two navigation buttons are disabled while the query has no matches.

The bar reports the current position and the total, such as `3 of 12`. Every match is highlighted, and the current match carries a stronger highlight. Moving to a match selects it in the document and scrolls it into view.

Matching runs asynchronously, so highlights appear shortly after the query changes. While the bar stays open, edits to the document update the matches. Closing the bar clears the highlights.

## Open and close the Find bar with the programmatic API

Use [`editor.find.open()`](https://www.nutrient.io/api/document-authoring/types/findnamespace/#open) to open the bar and focus its input:

```js

editor.find.open();

```

Pass `query` to preset the search text. The query replaces whatever the bar currently holds:

```js

editor.find.open({ query: 'hello' });

```

Use [`editor.find.close()`](https://www.nutrient.io/api/document-authoring/types/findnamespace/#close) to close the bar and clear the match highlights:

```js

editor.find.close();

```

Both methods do nothing when there’s nothing to change. Calling `open()` while the bar is already open with the same query is a no-op, and it doesn’t refocus the input. Calling `close()` while the bar is already closed is also a no-op.

The bar keeps its query after closing, so `open()` without a query reopens with the previous search text. That query lives in memory for the lifetime of the editor instance and isn’t restored after a page reload. Calling [`editor.setCurrentDocument()`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#setcurrentdocument) closes the bar and clears the query, while the `editor.find` handle itself stays valid.

## Connect Find to custom application chrome

Applications that replace the editor chrome drive the Find bar from their own button. Read [`editor.find.getState()`](https://www.nutrient.io/api/document-authoring/types/findnamespace/#getstate) on each click and branch on `open`:

```js

const editor = await docAuthSystem.createEditor(
  document.getElementById('editor'),
);

const findButton = document.getElementById('find-toggle');

findButton.addEventListener('click', () => {
  if (editor.find.getState().open) {
    editor.find.close();
    return;
  }

  editor.find.open();
});

```

The corresponding HTML for the button could look like this:

```html

<button id="find-toggle" type="button">Find</button>

```

Read the state at the moment of the click instead of tracking a Boolean in the host application. The bar also opens with Control/Command-F and closes with Escape or its close button, and neither route passes through host code. The editor emits no event for Find state changes, so a host-tracked flag drifts out of sync with the bar.

## What the Find bar searches

The bar searches the whole document, not only the visible page. It covers:

- Body text, including text in tables and nested tables

- Text inside shapes and text boxes

- Footnote and endnote text

- Headers and footers, including the tables and shapes they contain

Header and footer variants are searched only when the current layout renders them. A first-page or even-page variant that the document defines but never renders produces no matches.

The bar matches literal text — case-insensitively — within a single paragraph, and it doesn’t search comment text. To match case-sensitively, match a pattern, or replace matches, search with the programmatic API using [`searchText()`](https://www.nutrient.io/api/document-authoring/types/programmatic/textview/#searchtext) and [`replaceText()`](https://www.nutrient.io/api/document-authoring/types/programmatic/textview/#replacetext) as described in the [find and replace](https://www.nutrient.io/guides/document-authoring/editing-content/find-and-replace.md) guide.

## Learn more

- [Find and replace](https://www.nutrient.io/guides/document-authoring/editing-content/find-and-replace.md)

- [Actions and toolbar](https://www.nutrient.io/guides/document-authoring/customize/actions-and-toolbar.md)

- [Document Authoring API reference](https://www.nutrient.io/api/document-authoring/)
---

## Related pages

- [Customize actions and the toolbar](/guides/document-authoring/customize/actions-and-toolbar.md)
- [Use events and integration APIs](/guides/document-authoring/customize/events-and-integration.md)
- [Configure fonts](/guides/document-authoring/customize/fonts.md)
- [Set the locale and units](/guides/document-authoring/customize/localization-and-units.md)
- [Use spellcheck in Document Authoring](/guides/document-authoring/customize/spellcheck.md)

