Skip to main content

Theming

doclens ships with light and dark themes and supports full customization via CSS custom properties.

Theme Presets

<DocViewer theme="light" />
<DocViewer theme="dark" />

CSS Custom Properties

Override any variable on the viewer's container or globally:

.my-viewer {
--dv-bg: #1a1a2e;
--dv-text: #eee;
--dv-primary: #e94560;
--dv-highlight-color: #ffeb3b;
--dv-toolbar-bg: #16213e;
}

Theme Config Object

Combine a preset with variable overrides:

<DocViewer
theme={{
preset: 'dark',
variables: {
'--dv-primary': '#e94560',
'--dv-highlight-color': '#ffd700',
},
}}
/>

Available Variables

VariableDescriptionDefault (Light)
--dv-bgBackground color#ffffff
--dv-textText color#1a1a1a
--dv-primaryPrimary accent#2563eb
--dv-toolbar-bgToolbar background#f8f9fa
--dv-borderBorder color#e5e7eb
--dv-highlight-colorSearch highlight#ffeb3b
--dv-highlight-active-colorActive match#ff9800
--dv-highlight-term-1First search term#ffeb3b
--dv-highlight-term-2Second search term#a5d6a7
--dv-highlight-term-3Third search term#90caf9
--dv-highlight-term-4Fourth search term#f48fb1
--dv-highlight-term-5Fifth search term#ce93d8
--dv-font-familyFont familysystem-ui, sans-serif
--dv-font-sizeBase font size14px
--dv-border-radiusBorder radius6px

Copy Protection

Disable text selection and/or printing:

<DocViewer
document={{ uri: '/confidential.pdf' }}
disableSelection
disablePrint
/>

Header Configuration

Control which toolbar items are shown:

<DocViewer
document={{ uri: '/report.pdf' }}
header={{
show: true,
fileName: true,
search: true,
zoom: true,
pageNav: true,
fullscreen: true,
download: false,
print: false,
}}
/>

Hide the header entirely:

<DocViewer header={false} />

Custom Header Slots

Inject your own UI into the header:

<DocViewer
document={{ uri: '/report.pdf' }}
renderHeaderLeft={() => <MyLogo />}
renderHeaderRight={() => <ShareButton />}
/>