# Customize Thumbnail

This part will show the UI structure,layout, label of the thumbnail panel,etc. Fragment related details are as following UI fragments. Much more API details are as following API Reference (opens new window) document.

# Thumbnail Panel Structure Details

Before customizing the thumbnail UI, we need to know the following details:

  1. Thumbnail Addon
  2. Thumbnail Panel
  3. Thumbnail List

# Thumbnail Addon

Before using the thumbnail component, please make sure that thumbnail Addon is loaded correctly (refer to here). About how to load Addon, please refer to here.

# Thumbnail Panel

In the built-in layout template,<thumbnail-sidebar-panel></thumbnail-sidebar-panel> is the left sidebar thumbnail panel. And it is actually as the following template:

<thumbnail:sidebar-panel name="sidebar-thumbnail-panel" @lazy-content="active">
    <thumbnail:toolbar></thumbnail:toolbar>
    <thumbnail:complete-thumbnail-list></thumbnail:complete-thumbnail-list>
</thumbnail:sidebar-panel>

It includes <thumbnail:toolbar> and <thumbnail:complete-thumbnail-list>, if you want to exchange the structure, you can refer to the following template:

<thumbnail:sidebar-panel name="sidebar-thumbnail-panel" @lazy-content="active">
    <thumbnail:complete-thumbnail-list></thumbnail:complete-thumbnail-list>
    <thumbnail:toolbar></thumbnail:toolbar>
</thumbnail:sidebar-panel>

Next, by fragments, you can exchange the built-in sidebar-thumbnail-panel:

# Thumbnail List

<thumbnail:complete-thumbnail-list> includes all the features of the thumbnail list as follows:

<thumbnail:thumbnail-list
    @thumbnail:centered
    @thumbnail:rearrange-pages
    @thumbnail:drop-to-merge-doc
    @aria:label="thumbnail:title"
>
    <thumbnail:thumbnail-item
        @foreach="thumbnail in thumbnail_list.thumbnails track by id"
        @setter.thumbnail_id="thumbnail.id"
        @lazy-content="visible"
    >
        <div class="fv__ui-thumbnail-viewer-container">
            <thumbnail:thumbnail-viewer @setter.thumbnail="thumbnail" @thumbnail:visible-rect-control></thumbnail:thumbnail-viewer>
        </div>
        <div class="fv__ui-thumbnail-item-label">@{thumbnail.pageIndex+1}</div>
    </thumbnail:thumbnail-item>
</thumbnail:thumbnail-list>

Structure details as following:

Node Structure Type isRequired Details
<thumbnail:thumbnail-list> @thumbnail:centered Instruct N When dragging the sidebar panel to change the width of the panel, thumbnail list will automatically insert a line feed and be shown in the middle.
<thumbnail:thumbnail-list> @thumbnail:rearrange-pages Instruct N Drag the thumbnail to adjust the PDF pages' orders.
<thumbnail:thumbnail-list> @thumbnail:drop-to-merge-doc Instruct N Insert the PDF dragged to the thumbnail list to the specified position.
<thumbnail:thumbnail-list> @aria:label="thumbnail:title" Instruct N Accessibility attribute
<thumbnail:thumbnail-item> @foreach="thumbnail in thumbnail_list.thumbnails track by id" Instruct Y It is to create the thumbnail list, and cannot be modified.
<thumbnail:thumbnail-item> @setter.thumbnail_id="thumbnail.id" Instruct Y It is mandatory, and to set thumbnail ID.
<thumbnail:thumbnail-item> @lazy-content="active" Instruct N To improve the performance of loading the thumbnail.
div.fv__ui-thumbnail-viewer-container - HTML Element Y It is thumbnail-viewer container without any adjustment.
<thumbnail:thumbnail-viewer> @thumbnail:visible-rect-control Instruct N Mark and control the PDF visible area.
div.fv__ui-thumbnail-item-label - HTML Element N It is a container to show the current page's abbreviated information. After modifying the container, much more information will be shown.

When you need to customize the thumbnail list, you should exchange <thumbnail:complete-thumbnail-list> to the above template as following:

Run the above example, the result is same with the built-in result.

# Start to Customize Thumbnail

# Customize Thumbnail Elements

After changing <div class="fv__ui-thumbnail-item-label">@{thumbnail.pageIndex+1}</div> to <div class="fv__ui-thumbnail-item-label">Page: @{thumbnail.pageIndex+1}</div>,the result is as following:

You can adjust the thumbnail structure and insert much more components:

# Customize Thumbnail Right Click Menu

The following is the template of the thumbnail right click menu:

<contextmenu name="fv--thumbnail-contextmenu" @thumbnail:permission>
    <contextmenu-item feature="rotate" name="contextmenu-item-thumbnail-rotate-left" @controller="thumbnail:RotateLeftController">thumbnail:contextmenu.rotateLeft</contextmenu-item>
    <contextmenu-item feature="rotate" name="contextmenu-item-thumbnail-rotate-right" @controller="thumbnail:RotateRightController">thumbnail:contextmenu.rotateRight</contextmenu-item>
    <contextmenu-separator></contextmenu-separator>
    <contextmenu-item feature="insert" name="contextmenu-item-thumbnail-add-blank-page" @controller="thumbnail:InsertBlankPageController">thumbnail:contextmenu.addBlankPage</contextmenu-item>
    <contextmenu-separator></contextmenu-separator>
    <thumbnail:delete-page-contextmenu-item name="contextmenu-item-thumbnail-delete"></thumbnail:delete-page-contextmenu-item>
</contextmenu>

We can configure the fragments to delete or add the menu item: