Docs

PDF Viewer Styling

Styling API reference for the PDF Viewer component.

Style Properties

The following style properties can be used in CSS stylesheets to customize the appearance of this component.

To apply values to these properties globally in your application UI, place them in a CSS block using the html {…​} selector. See Component Style Properties for more information on style properties.

Property Supported by

--vaadin-pdf-viewer-background

Aura, Lumo

--vaadin-pdf-viewer-border-color

Aura, Lumo

--vaadin-pdf-viewer-border-radius

Aura, Lumo

--vaadin-pdf-viewer-padding

Aura, Lumo

--vaadin-pdf-viewer-page-background

Aura, Lumo

--vaadin-pdf-viewer-page-gap

Aura, Lumo

--vaadin-pdf-viewer-page-shadow

Aura, Lumo

--vaadin-pdf-viewer-text-color

Aura, Lumo

--vaadin-pdf-viewer-toolbar-background

Aura, Lumo

--vaadin-pdf-viewer-toolbar-gap

Aura, Lumo

--vaadin-pdf-viewer-toolbar-padding

Aura, Lumo

CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the Styling documentation for more details on how to style components.

Important
Not for Shadow DOM
These selectors should be used in styles.css or another stylesheet loaded with the @StyleSheet annotation or the @import CSS rule. They do not work in the shadow DOM of Vaadin components, such as in stylesheets in the components sub-folder or loaded with the @CssImport annotation’s themeFor property.

Root element

vaadin-pdf-viewer

States

Loading a document

vaadin-pdf-viewer[loading]

Document failed to load

vaadin-pdf-viewer[has-error]

Page area focused

vaadin-pdf-viewer[focused]

Page area keyboard focused

vaadin-pdf-viewer[focus-ring]

Header

vaadin-pdf-viewer::part(header)

Title

vaadin-pdf-viewer::part(title)

Collapse and expand icon

vaadin-pdf-viewer::part(header-toggle)

Toolbar

Toolbar

vaadin-pdf-viewer::part(toolbar)

Group of related controls

vaadin-pdf-viewer::part(toolbar-group)

Each control of the toolbar has a slot of its own. The controls are Vaadin components: the buttons are Button components, the page field is an Integer Field, and the zoom select is a Select. Style them as you style these components.

Previous page button

vaadin-pdf-viewer > [slot="toolbar-previous-page"]

Next page button

vaadin-pdf-viewer > [slot="toolbar-next-page"]

Page field

vaadin-pdf-viewer > [slot="toolbar-page"]

Zoom out button

vaadin-pdf-viewer > [slot="toolbar-zoom-out"]

Zoom select

vaadin-pdf-viewer > [slot="toolbar-zoom"]

Zoom in button

vaadin-pdf-viewer > [slot="toolbar-zoom-in"]

Download button

vaadin-pdf-viewer > [slot="toolbar-download"]

Toolbar actions

vaadin-pdf-viewer > [slot="toolbar-actions"]

In Flow, the toolbar actions are inside a container element in the toolbar-actions slot. To target the actions themselves, use vaadin-pdf-viewer > [slot="toolbar-actions"] > *.

Pages

Scrollable page area

vaadin-pdf-viewer::part(content)

Page

vaadin-pdf-viewer::part(page)

Loading indicator

vaadin-pdf-viewer::part(loader)

Updated –