---
title: "JavaScript PDF viewer with document outline | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/web/user-interface/sidebar/document-outline/"
md_url: "https://www.nutrient.io/guides/web/user-interface/sidebar/document-outline.md"
last_updated: "2026-05-19T18:11:34.035Z"
description: "Discover how to use and customize the document outline sidebar in Nutrient Web SDK, enhancing user navigation with expandable trees and CSS styling."
---

# Document outline in our JavaScript PDF viewer

Nutrient Web SDK’s UI features a sidebar with different available views.

When a document contains an outline, the document outline sidebar renders it as an expandable content tree with selectable items. The user can click on these items to navigate to different parts of the document.

<!-- This partial is rendered in guide articles describing sidebars. -->

The document-outline sidebar can be shown by the user by selecting the document-outline sidebar icon from the sidebar dropdown in the toolbar.

It can also be shown programmatically with the API:

```js

instance.setViewState(viewState => viewState.set("sidebarMode", NutrientViewer.SidebarMode.DOCUMENT_OUTLINE);

```

Additionally, it’s possible to make it appear when the document is loaded by setting [`NutrientViewer.Configuration#initialViewState`](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#initialViewState):

```js

NutrientViewer.load({
  initialViewState: new NutrientViewer.ViewState({
    sidebarMode: NutrientViewer.SidebarMode.DOCUMENT_OUTLINE
  })
});

```

The sidebar, which appears to the left of the viewport by default, can also be configured to appear to the right. To do this, you only need to set [`NutrientViewer.ViewState#sidebarPlacement`](https://www.nutrient.io/api/web/NutrientViewer.ViewState.html#sidebarPlacement):

```js

instance.setViewState(viewState => (
  viewState.set("sidebarPlacement", NutrientViewer.SidebarPlacement.END)
));

```

The image below shows how sidebar looks once placed using the previous snippet.

If you don’t want users to be able to open the document-outline sidebar, you can hide the corresponding toolbar button by filtering it out from the [default toolbar items](https://www.nutrient.io/api/web/NutrientViewer.html#.defaultToolbarItems):

```js

NutrientViewer.setToolbarItems(items => items.filter(item => item.type!== "sidebar-document-outline"));

```







The document outline view toolbar button can be styled with CSS using the public CSS class `.PSPDFKit-Toolbar-Button-Sidebar-Document-Outline`.

The document outline sidebar itself can also be customized with CSS by modifying the corresponding public CSS classes:

- `.PSPDFKit-Sidebar-Document-Outline`

- `.PSPDFKit-Sidebar-Document-Outline-Heading`
---

## Related pages

- [Customizing the sidebar component in our JavaScript PDF viewer](/guides/web/user-interface/sidebar/customization.md)
- [Annotations list in our viewer sidebar](/guides/web/user-interface/sidebar/annotations-list.md)
- [Bookmark navigation in our JavaScript PDF viewer](/guides/web/user-interface/sidebar/bookmarks.md)
- [Hide or show sidebar navigation in our viewer](/guides/web/customizing-the-interface/controlling-the-sidebar-via-api.md)
- [Customizing the OCG layers icon in our PDF viewer UI](/guides/web/user-interface/sidebar/layers.md)
- [Navigate signed and unsigned signature fields in our PDF viewer sidebar](/guides/web/user-interface/sidebar/signatures-list.md)
- [Thumbnail preview in our JavaScript PDF viewer](/guides/web/user-interface/sidebar/thumbnail-preview.md)

