---
title: "Plugins — React"
description: "Every feature of the viewer is a headless plugin. Set any plugin's settings, change them while the viewer runs, use their hooks in your components, and add a plugin of your own."
integration: "React"
other_integrations:
  "Vanilla JS": "https://www.embedpdf.com/docs/viewer/vanilla/code/plugins.md"
  "Vue": "https://www.embedpdf.com/docs/viewer/vue/code/plugins.md"
  "Svelte": "https://www.embedpdf.com/docs/viewer/svelte/code/plugins.md"
  "Angular": "https://www.embedpdf.com/docs/viewer/angular/code/plugins.md"
source: "https://www.embedpdf.com/docs/viewer/react/code/plugins"
---

# Plugins

The viewer is the [headless](https://www.embedpdf.com/docs/headless/react.md) plugins with an interface built on top. Every feature
is a plugin: search is the search plugin, the comments panel uses the annotation plugin's comments.
So everything the headless docs say about a plugin is true inside the viewer, with the same names:

- its **settings** go in `plugins`, under its name;
- its **API** is `viewer.get(name)`;
- its **hooks** work in your own components inside the viewer.

## Every plugin

| Name          | What it does                                                                    | Headless page                                                                                                        |
| :------------ | :------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------- |
| `stage`       | Scrolling, zoom, page layout and navigation                                     | [Scroll, zoom & layout](https://www.embedpdf.com/docs/headless/react/viewing/stage.md)                               |
| `thumbnails`  | The thumbnails panel: a second `stage` over the same document                   | [Two views of one document](https://www.embedpdf.com/docs/headless/react/viewing/stage.md#two-views-of-one-document) |
| `render`      | Sharp pages at every zoom                                                       | [Rendering](https://www.embedpdf.com/docs/headless/react/viewing/render.md)                                          |
| `link`        | Links to pages and websites                                                     | [Links](https://www.embedpdf.com/docs/headless/react/viewing/links.md)                                               |
| `selection`   | Selecting and copying text                                                      | [Selecting & copying](https://www.embedpdf.com/docs/headless/react/text/selection.md)                                |
| `search`      | Finding text                                                                    | [Search](https://www.embedpdf.com/docs/headless/react/text/search.md)                                                |
| `annotation`  | Annotations, their tools, and comments                                          | [Annotations](https://www.embedpdf.com/docs/headless/react/annotations.md)                                           |
| `stamp`       | Stamp libraries                                                                 | [Stamps](https://www.embedpdf.com/docs/headless/react/annotations/stamps.md)                                         |
| `measurement` | Measuring at a drawing's scale                                                  | [Measurements](https://www.embedpdf.com/docs/headless/react/annotations/measurements.md)                             |
| `redaction`   | Removing content for good                                                       | [Redaction](https://www.embedpdf.com/docs/headless/react/annotations/redaction.md)                                   |
| `form`        | Filling and building forms                                                      | [Filling forms](https://www.embedpdf.com/docs/headless/react/forms.md)                                               |
| `signature`   | Signing and checking signatures                                                 | [Signatures](https://www.embedpdf.com/docs/headless/react/forms/signatures.md)                                       |
| `pageEdit`    | Rotating, moving, inserting and deleting pages                                  | [Organizing pages](https://www.embedpdf.com/docs/headless/react/documents/pages.md)                                  |
| `metadata`    | A document's title, author and your own fields                                  | [Metadata](https://www.embedpdf.com/docs/headless/react/documents/metadata.md)                                       |
| `fonts`       | The fonts a document can be written in, and drawing its text in a browser       | [Fonts](https://www.embedpdf.com/docs/headless/react/documents/fonts.md)                                             |
| `outline`     | The outline (bookmarks): following, adding, renaming, moving and deleting items | [Outline](https://www.embedpdf.com/docs/headless/react/documents/outline.md)                                         |
| `attachment`  | The files inside the PDF: listing, saving, attaching and removing them          | [Attachments](https://www.embedpdf.com/docs/headless/react/documents/attachments.md)                                 |
| `actions`     | What a PDF does by itself: buttons, scripts, printing                           | [Actions & scripts](https://www.embedpdf.com/docs/headless/react/documents/actions.md)                               |
| `documents`   | Opening, closing, tabs and saving                                               | [Opening documents](https://www.embedpdf.com/docs/headless/react/documents/opening.md)                               |
| `interaction` | The active tool, cursors and touch                                              | [Tools, cursors & touch](https://www.embedpdf.com/docs/headless/react/ui/tools.md)                                   |
| `commands`    | Every button's action, and shortcuts                                            | [Commands & shortcuts](https://www.embedpdf.com/docs/headless/react/ui/commands.md)                                  |
| `shell`       | Which panels and menus are open                                                 | [Panels & dialogs](https://www.embedpdf.com/docs/headless/react/ui/panels.md)                                        |
| `i18n`        | The language                                                                    | [Translations](https://www.embedpdf.com/docs/headless/react/ui/translations.md)                                      |

## Settings

`plugins` takes each plugin's settings by its name, exactly as its page lists them under
**Settings**:

```js
{
  plugins: {
    stage: { spread: 'odd', zoom: { mode: 'fit-width' } },
    selection: { color: 'rgb(124 58 237 / 0.3)' },
    actions: { javascript: { enabled: false } },
  },
}
```

**`settings.tsx`**

```tsx
import { PDFViewer, type ViewerConfig } from '@embedpdf/viewer-react';

const links = 'https://www.embedpdf.com/pdfs/links.pdf';

const config: ViewerConfig = {
  plugins: {
    stage: { spread: 'odd', zoom: { mode: 'fit-width' } },
    selection: { color: 'rgb(124 58 237 / 0.3)' },
  },
};

export default function App() {
  return <PDFViewer src={links} {...config} style={{ height: '100%' }} />;
}
```

> **Try it:** the brand guidelines open two pages at a time, at the width of the frame. Select some
> text: the selection is purple.

Change them while the viewer runs, and go back to what you set:

```js
viewer.get('stage').updateSettings({ layout: 'horizontal' });
viewer.get('stage').resetSettings();
```

A change reaches every document, open or opened later, except for `stage` and `thumbnails`: their
settings are each document's own view of it. Changed from code, they change the active document,
or the one you name with `viewer.forDocument(id)`, and a document that opens later starts from
what `plugins` says.

A few plugins take settings that only the viewer has, such as the standard stamps of
`plugins.stamp`. The feature pages list them: [Annotations](https://www.embedpdf.com/docs/viewer/react/features/annotations.md),
[Forms & signatures](https://www.embedpdf.com/docs/viewer/react/features/forms-and-signatures.md).

## In your components

Your own components inside the viewer can use every headless hook. Install the headless adapter
for your framework next to the viewer (`@embedpdf/react`, `@embedpdf/vue`, `@embedpdf/svelte` or
`@embedpdf/angular`, the same version), and use its hooks as the headless docs show them:

**`hooks.tsx`**

```tsx
import { useSearch, useSearchState } from '@embedpdf/react/search';

// A search box of your own, in the viewer's header. The hooks are the headless ones.
export function HeaderSearch() {
  const search = useSearch();
  const { hitCount, activeHitIndex } = useSearchState();

  return (
    <form onSubmit={(event) => event.preventDefault()}>
      <input type="search" placeholder="Search" onChange={(event) => search.search({ text: event.target.value })} />
      {hitCount > 0 && <span>{activeHitIndex + 1} of {hitCount}</span>}
      <button type="button" onClick={() => search.nextHit()}>Next</button>
    </form>
  );
}
```

Put `HeaderSearch` in the viewer's `header` [region](https://www.embedpdf.com/docs/viewer/react/customize/components.md#above-below-and-when-nothing-is-open),
and it searches the open document. The hooks find the viewer they're in, and the document that's
active, by themselves.

## A plugin of your own

A plugin you wrote for headless works in the viewer too. Give it a name in `plugins`:

```js
import { analyticsPlugin } from './analytics-plugin';

export const config = {
  plugins: {
    analytics: analyticsPlugin({ endpoint: '/api/events' }),
  },
};
```

`viewer.get('analytics')` is then its API, its commands can go in the [layout](https://www.embedpdf.com/docs/viewer/react/customize/layout.md),
and your components can use its hooks. See [How it works](https://www.embedpdf.com/docs/headless/react/concepts/how-it-works.md#plugins)
in the headless docs for writing one.

## When to build your own interface

The viewer lets you move, add and replace everything around the pages. Go [headless](https://www.embedpdf.com/docs/headless/react.md)
when you need to change what it doesn't open up:

- the look of its own buttons, menus and panels beyond [theming](https://www.embedpdf.com/docs/viewer/react/customize/theming.md);
- an arrangement that isn't bars, panels and regions;
- what's drawn on the pages themselves, such as annotations drawn your own way.

Everything on this page carries over: the same plugins, settings, names and hooks.
