File: blockui.md | Updated: 11/15/2025
Introducing PrimeReact v11 Alpha 🥁Learn More
SearchK
10.9.7
FEATURES
API
THEMING
PASS THROUGH
BlockUI can block certain elements or the whole page.
Import#
import { BlockUI } from 'primereact/blockui';
Copy
Basic#
The element to block should be placed as a child of BlockUI and blocked property is required to control the state.
BlockUnblock
Basic
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<div className="mb-3">
<Button label="Block" onClick={() => setBlocked(true)} className="mr-2"></Button>
<Button label="Unblock" onClick={() => setBlocked(false)} severity="secondary"></Button>
</div>
<BlockUI blocked={blocked}>
<Panel header="Basic">
<p className="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.
</p>
</Panel>
</BlockUI>
Copy
Document#
Enabling fullScreen property controls the document.
Block
<BlockUI blocked={blocked} fullScreen />
<Button label="Block" onClick={() => setBlocked(true)} />
Copy
Template#
Custom content can be placed inside the modal layer using the template property.
Prime React News
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Subscribe
<BlockUI blocked={blocked} template={<i className="pi pi-lock" style={{ fontSize: '3rem' }}></i>}>
<Panel header="Prime React News">
<p className="m-0">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.
</p>
</Panel>
</BlockUI>
<div className="mt-3 flex flex-column align-items-center">
<h3>Continue reading?</h3>
<Button label={buttonText} onClick={() => setBlocked((oldState) => !oldState)}></Button>
</div>
Copy
Accessibility#
BlockUI manages aria-busy state attribute when the UI gets blocked and unblocked. Any valid attribute is passed to the root element so additional attributes like role and aria-live can be used to define live regions.
Component does not include any interactive elements.
Import
Basic
Document
Template
Accessibility
PrimeReact 10.9.7 by PrimeTek