Overlays & utilities
Layers that sit above the page. Modal overlays trap focus, close with Escape and return focus to the control that opened them; non-modal ones dismiss on outside click.
13 components on this page. Every demo is live — change the theme in the header or flip a demo to right-to-left with its RTL button. 10 of them are React-only for now; Vue, Svelte and Angular versions are coming.
Dialog Link to Dialog
A modal window for focused tasks and decisions.
Result: —
Code
<Button onClick={() => setOpen(true)}>Open</Button>
<Dialog open={open} title="Delete project?" onClose={() => setOpen(false)}
footer={<Button variant="danger">Delete</Button>}>
This cannot be undone.
</Dialog> <Dialog :open="open" title="Delete project?" @close="open = false">
This cannot be undone.
<template #footer><Button variant="danger">Delete</Button></template>
</Dialog> <Dialog {open} title="Delete project?" onclose={() => (open = false)}>
This cannot be undone.
{#snippet footer()}<Button variant="danger">Delete</Button>{/snippet}
</Dialog> <Button data-pl-open="confirm">Open</Button>
<Dialog id="confirm" title="Delete project?">
This cannot be undone.
<Button slot="footer" variant="danger" data-pl-close>Delete</Button>
</Dialog> <Dialog visible={open} title="Delete project?" onClose={() => setOpen(false)}
footer={<Button title="Delete" variant="danger" />}>
<Text>This cannot be undone.</Text>
</Dialog> Drawer Link to Drawer
A panel that slides in from the start or end edge.
Code
<Drawer open={open} title="Filters" onClose={() => setOpen(false)}>
<Checkbox label="Only active members" />
</Drawer> <Drawer :open="open" title="Filters" @close="open = false">…</Drawer> <Drawer {open} title="Filters" onclose={() => (open = false)}>…</Drawer> <Button data-pl-open="filters">Filters</Button>
<Drawer id="filters" title="Filters">…</Drawer> <Drawer visible={open} title="Filters" onClose={() => setOpen(false)}>…</Drawer> Tooltip Link to Tooltip
A short hint shown on hover and keyboard focus.
Code
<Tooltip text="Copy link to clipboard"><Button>Copy link</Button></Tooltip> <Tooltip text="Copy link to clipboard"><Button>Copy link</Button></Tooltip> <Tooltip text="Copy link to clipboard">
{#snippet children(attrs)}<Button {...attrs}>Copy link</Button>{/snippet}
</Tooltip> <Tooltip text="Copy link to clipboard"><Button>Copy link</Button></Tooltip> Popover Link to Popover
A non-modal floating panel anchored to a trigger, for interactive content.
Code
ReactComing to Vue, Svelte and Angular.
<Popover aria-label="Share" showCloseIcon trigger={<Button>Share</Button>}>
<Input label="Link" readOnly value="https://…" />
</Popover> ConfirmDialog Link to ConfirmDialog
An alert dialog that asks the user to confirm, via a component or the useConfirm() hook.
Result: —
Component: —
Code
ReactComing to Vue, Svelte and Angular.
function DeleteButton() {
const { confirm } = useConfirm();
return <Button variant="danger" onClick={async () => {
if (await confirm({ header: 'Delete project?', message: 'This cannot be undone.', severity: 'danger', acceptLabel: 'Delete' })) remove();
}}>Delete</Button>;
}
<ConfirmProvider><DeleteButton /></ConfirmProvider> ConfirmPopup Link to ConfirmPopup
A lightweight confirmation anchored to the button that triggered it.
Result: —
Component: —
Code
ReactComing to Vue, Svelte and Angular.
const { confirm } = useConfirm();
<Button onClick={(e) => confirm({ target: e.currentTarget, message: 'Archive this item?' })}>Archive</Button> DialogProvider / useDialog Link to DialogProvider / useDialog
Open any component in a dialog from code and await its result.
Accent: Violet
Code
ReactComing to Vue, Svelte and Angular.
function PickColor({ dialogRef }: DynamicDialogContentProps<void, string>) {
return <Button onClick={() => dialogRef.close('teal')}>Teal</Button>;
}
const { open } = useDialog();
const color = await open(PickColor, { header: 'Pick a colour' }).result; BlockUI Link to BlockUI
Blocks interaction with a region (or the whole page) while work is in progress.
Code
ReactComing to Vue, Svelte and Angular.
<BlockUI blocked={saving} label="Saving…">
<Card title="Profile">…</Card>
</BlockUI> ScrollTop Link to ScrollTop
A button that appears after scrolling and returns to the top.
v0.30.0 — improvements and fixes. Scroll down to reveal the button.
v0.29.0 — improvements and fixes. Scroll down to reveal the button.
v0.28.0 — improvements and fixes. Scroll down to reveal the button.
v0.27.0 — improvements and fixes. Scroll down to reveal the button.
v0.26.0 — improvements and fixes. Scroll down to reveal the button.
v0.25.0 — improvements and fixes. Scroll down to reveal the button.
v0.24.0 — improvements and fixes. Scroll down to reveal the button.
v0.23.0 — improvements and fixes. Scroll down to reveal the button.
v0.22.0 — improvements and fixes. Scroll down to reveal the button.
v0.21.0 — improvements and fixes. Scroll down to reveal the button.
v0.20.0 — improvements and fixes. Scroll down to reveal the button.
v0.19.0 — improvements and fixes. Scroll down to reveal the button.
v0.18.0 — improvements and fixes. Scroll down to reveal the button.
v0.17.0 — improvements and fixes. Scroll down to reveal the button.
v0.16.0 — improvements and fixes. Scroll down to reveal the button.
v0.15.0 — improvements and fixes. Scroll down to reveal the button.
v0.14.0 — improvements and fixes. Scroll down to reveal the button.
v0.13.0 — improvements and fixes. Scroll down to reveal the button.
v0.12.0 — improvements and fixes. Scroll down to reveal the button.
v0.11.0 — improvements and fixes. Scroll down to reveal the button.
v0.10.0 — improvements and fixes. Scroll down to reveal the button.
v0.9.0 — improvements and fixes. Scroll down to reveal the button.
v0.8.0 — improvements and fixes. Scroll down to reveal the button.
v0.7.0 — improvements and fixes. Scroll down to reveal the button.
v0.6.0 — improvements and fixes. Scroll down to reveal the button.
v0.5.0 — improvements and fixes. Scroll down to reveal the button.
v0.4.0 — improvements and fixes. Scroll down to reveal the button.
v0.3.0 — improvements and fixes. Scroll down to reveal the button.
v0.2.0 — improvements and fixes. Scroll down to reveal the button.
v0.1.0 — improvements and fixes. Scroll down to reveal the button.
Code
ReactComing to Vue, Svelte and Angular.
<ScrollTop /> {/* window */}
<div ref={box} style={{ overflow: 'auto', height: 240 }}>
…
<ScrollTop target={box} threshold={100} />
</div> Inplace Link to Inplace
Shows a read-only value that turns into an editor when activated.
Code
ReactComing to Vue, Svelte and Angular.
<Inplace display={name} closable>
{(close) => <Input label="Name" value={name} onChange={(e) => setName(e.target.value)} onBlur={close} />}
</Inplace> FocusTrap Link to FocusTrap
Keeps keyboard focus inside a region while it is active.
Code
ReactComing to Vue, Svelte and Angular.
<FocusTrap active={editing}>
<Input label="Title" /> <Button onClick={() => setEditing(false)}>Done</Button>
</FocusTrap> AnimateOnScroll Link to AnimateOnScroll
Reveals content with an animation when it scrolls into view.
Code
ReactComing to Vue, Svelte and Angular.
<AnimateOnScroll>
<Card title="Fades in">…</Card>
</AnimateOnScroll> Ripple Link to Ripple
An ink-ripple effect for any clickable element, as a component or hook.
Code
ReactComing to Vue, Svelte and Angular.
<button className="pl-btn pl-btn--primary">Save<Ripple /></button>
const ref = useRipple<HTMLDivElement>();
<div ref={ref} className="tile">Click me</div>