`renderDefaultToolbar`
function and transforming the toolbar to your own one. It is recommended to take a look at the customize the default toolbar example to see the details.`Download`
, `EnterFullScreen`
and `SwitchTheme`
slots are removed the from the default toolbar:import type { ToolbarSlot, TransformToolbarSlot } from '@react-pdf-viewer/toolbar';const toolbarPluginInstance = toolbarPlugin();const { renderDefaultToolbar, Toolbar } = toolbarPluginInstance;const transform: TransformToolbarSlot = (slot: ToolbarSlot) => ({...slot,// These slots will be emptyDownload: () => <></>,EnterFullScreen: () => <></>,SwitchTheme: () => <></>,});
`renderDefaultToolbar`
function as following:const { renderDefaultToolbar, Toolbar } = toolbarPluginInstance;<Toolbar>{renderDefaultToolbar(transform)}</Toolbar>;
Slots can be used in the toolbar | Identical slot shown in the menu | Description |
---|---|---|
`GoToFirstPage` | `GoToFirstPageMenuItem` | Go to the first page |
`GoToLastPage` | `GoToLastPageMenuItem` | Go to the last page |
`GoToNextPage` | `GoToNextPageMenuItem` | Go to the next page |
`GoToPreviousPage` | `GoToPreviousPageMenuItem` | Go to the previous page |
`Download` | `DownloadMenuItem` | Download the current document |
`EnterFullScreen` | `EnterFullScreenMenuItem` | Enter the full screen mode |
`Open` | `OpenMenuItem` | Open a local document |
`Print` | `PrintMenuItem` | Print the current document |
`Rotate` | `RotateBackwardMenuItem` | Rotate the current document |
`RotateForwardMenuItem` | ||
`ShowProperties` | `ShowPropertiesMenuItem` | Show the properties of current document |
`SwitchScrollMode` | `SwitchScrollModeMenuItem` | Switch the scroll mode |
`SwitchSelectionMode` | `SwitchSelectionModeMenuItem` | Switch the selection mode |
`SwitchTheme` | `SwitchThemeMenuItem` | Change to another theme |
`ZoomIn` | `ZoomInMenuItem` | Zoom in the current document |
`ZoomOut` | `ZoomOutMenuItem` | Zoom out the current document |
const transform: TransformToolbarSlot = (slot: ToolbarSlot) => ({...slot,// These slots will be emptyDownload: () => <></>,DownloadMenuItem: () => <></>,EnterFullScreen: () => <></>,EnterFullScreenMenuItem: () => <></>,SwitchTheme: () => <></>,SwitchThemeMenuItem: () => <></>,});