Use the default open button

The following example uses the default open button <OpenButton /> provided by the Open plugin.
import { Viewer } from '@react-pdf-viewer/core';
import { openPlugin } from '@react-pdf-viewer/open';
import '@react-pdf-viewer/core/lib/styles/index.css';
import '@react-pdf-viewer/open/lib/styles/index.css';
const openPluginInstance = openPlugin();
const { OpenButton } = openPluginInstance;
// Your render function
const openPluginInstance = openPlugin();
const { OpenButton } = openPluginInstance;
return (
<div
className="rpv-core__viewer"
style={{
border: '1px solid rgba(0, 0, 0, 0.3)',
display: 'flex',
flexDirection: 'column',
height: '100%',
}}
>
<div
style={{
alignItems: 'center',
backgroundColor: '#eeeeee',
borderBottom: '1px solid rgba(0, 0, 0, 0.1)',
display: 'flex',
padding: '4px',
}}
>
<OpenButton />
</div>
<div
style={{
flex: 1,
overflow: 'hidden',
}}
>
<Viewer fileUrl="/assets/pdf-open-parameters.pdf" plugins={[openPluginInstance]} />
</div>
</div>
);

Related example