<SwitchSelectionModeButton mode={SelectionMode.Hand} />
<SwitchSelectionModeButton mode={SelectionMode.Text} />
The following example uses the default button to switch the selection mode.
import { SelectionMode } from '@react-pdf-viewer/selection-mode';
const selectionModePluginInstance = selectionModePlugin();
const { SwitchSelectionModeButton } = selectionModePluginInstance;
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.3)',
display: 'flex',
justifyContent: 'center',
padding: '4px',
}}
>
<div style={{ padding: '0px 2px' }}>
<SwitchSelectionModeButton mode={SelectionMode.Hand} />
</div>
<div style={{ padding: '0px 2px' }}>
<SwitchSelectionModeButton mode={SelectionMode.Text} />
</div>
</div>
<div
style={{
flex: 1,
overflow: 'hidden',
}}
>
<Viewer fileUrl="/assets/pdf-open-parameters.pdf" plugins={[selectionModePluginInstance]} />
</div>
</div>
);