Set the initial tab in the default layout

The default layout includes a sidebar which consists of three tabs shown in the following order, from the top to bottom:
By default, those tabs are hidden. If you want to activate a tab initially, then you can use the `setInitialTab` option.
It is a function that takes the current document as its single parameter, and returns a `Promise<number>`. The number resolved by the `Promise` is the zero-based index of the tab that you would like to open:
setInitialTab: (doc: PdfJs.PdfDocument) => Promise<number>
The following piece of code sets the thumbnails tab activated initially, because the index of the thumbnails tab is zero:
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';
const defaultLayoutPluginInstance = defaultLayoutPlugin({
setInitialTab: (doc) => Promise.resolve(0),
});

See also