ReadOnlyFrame
The PR mock's View-as panel (.vb): the brand's page on the soft grey (padding 20, radius 28), shown but not usable. The panel is inert (nothing in it takes focus, a click, or a screen reader's cursor), aria-disabled, has pointer-events: none and no text selection, so a disabled-looking button in it is not a trap. Put the way out (an "Exit view as" banner) outside it; label adds a line above it that stays readable.
import { ReadOnlyFrame } from '@ergasti/bricks';Examples
View as brand
The brand's own page on the soft grey, inert: nothing in it takes focus or a click, so a disabled button in it is no trap. Keep the way out (here a banner) outside the frame.
Code
import { Banner, Button, Card, PageGrid, ReadOnlyFrame, Tile } from '@ergasti/bricks';
function ViewAs() {
return (
<div>
<Banner tone="info" icon="eye">You are seeing Glow Lab's portal as the brand sees it.</Banner>
<ReadOnlyFrame label="Glow Lab's home, read only">
<PageGrid cols={4}>
<Tile tone="lime" size="kpi" label="Sales from creators" value="EGP 412,300" />
<Tile tone="sky" size="kpi" label="Orders" value="1,284" />
<Tile tone="butter" size="kpi" label="Active creators" value="86" />
<Tile tone="rasp" size="kpi" label="Wallet" value="EGP 43,390" />
</PageGrid>
<PageGrid split="8-4" align="start">
<Card title="Your creators" actions={<Button size="sm" disabled>Invite</Button>}><p style={{ margin: 0 }}>Sara Ali, Nour Hassan</p></Card>
<Card title="Challenges"><Button disabled>Request a challenge</Button></Card>
</PageGrid>
</ReadOnlyFrame>
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses ReadOnlyFrame. Written in docs/content/components/ReadOnlyFrame.md; the props above are read from the code, which wins where the two disagree.
A soft grey panel that shows a page but lets nothing in it be used (it is inert); use it for the PR Portal's View as brand, where PR sees the brand's own page read only.
It is the PR v3 mock's .vb panel (background: var(--soft); padding: 20px; pointer-events: none; user-select: none). The mock's CSS only blocks the mouse, so a copy of that class still lets keyboard and screen-reader users reach the buttons inside. ReadOnlyFrame also makes the panel inert (nothing in it takes focus, a click or a screen reader's cursor), aria-disabled, unselectable and pointer-less, so use it instead whenever a page is shown for looking only. Put the way out (the ViewAsBanner "Exit view") outside it.
Anatomy
- Wrapper (only with
label):.kit-ro-wrap, a grid, 8px gap. - Label (optional):
.kit-ro-l, 12px / 600--ink-3, outside the inert part so it stays readable ("Glow Lab's home, as the brand sees it. Read only."). - Panel:
<div class="kit-ro" inert aria-disabled="true">: grid with 16px gap, padding 20, radius 28,--softbackground,pointer-events: none, no text selection. - Children: the page shown, usually
PageGrids of tiles and cards.
Variants
| Prop value | Look | When to use |
|---|---|---|
no label | Panel only | A banner above already says what it is (ViewAsBanner). |
label | A muted line above the panel | Nothing above explains it; the line stays readable by screen readers. |
States
| State | How |
|---|---|
| Read only | Always: the panel is inert (set on the node by a ref callback, since React 18 has no inert prop). |
| Label added or removed | Changing label after mount remounts the panel's content (each side is a fresh node). |
Usage
// PR Portal › Brand detail › View as brand: the ink banner, then the brand's home, read only
import { Avatar, Button, Card, Money, PageGrid, ReadOnlyFrame, RequestChallengeCard, Tile, ViewAsBanner } from '@ergasti/bricks';
export function ViewAsBrand({ exit }: { exit: () => void }) {
return (
<>
<ViewAsBanner brandName="Glow Lab" onExit={exit} />
<ReadOnlyFrame>
<PageGrid cols={4}>
<Tile tone="lime" size="kpi" label="Sales from creators" value={<Money value="412300.00" />} />
<Tile tone="sky" size="kpi" label="Orders" value="1,284" />
<Tile tone="butter" size="kpi" label="Active creators" value="86" />
<Tile tone="rasp" size="kpi" label="Wallet" value={<Money value="43390.00" />} />
</PageGrid>
<PageGrid split="8-4" align="start">
<Card title="Your creators" actions={<Button size="sm" disabled>Invite</Button>}>
<Avatar name="Sara Ali" seed={2} /> Sara Ali
</Card>
<RequestChallengeCard />
</PageGrid>
</ReadOnlyFrame>
</>
);
}// With its own label when no banner explains it
import { Card, ReadOnlyFrame } from '@ergasti/bricks';
export function ReadOnlyPreview() {
return (
<ReadOnlyFrame label="Glow Lab's home, as the brand sees it. Read only.">
<Card title="Your creators"><p style={{ margin: 0 }}>Sara Ali, Nour Hassan</p></Card>
</ReadOnlyFrame>
);
}Where it appears
- PR Portal › Brand detail › View as brand: under
ViewAsBanner, holding the brand's fourTile size="kpi", Your creators with a disabled Invite, andRequestChallengeCard(PR · View as brand).
Guidelines
Do
- Show the page exactly as its owner sees it, buttons and all; disable them so they look unavailable.
- Keep the exit (
ViewAsBanner's "Exit view") and any explanation outside the frame. - Use
labelwhen no banner says what the panel is.
Don't
- Don't put anything inside it that the viewer must use: it cannot be focused or clicked.
- Don't use it for a loading or disabled form; use the form's own
disabled/busystates. - Don't nest a second
ReadOnlyFrameinside it.
RTL and Arabic
- The content mirrors as it would on its own page; the panel has no direction-specific parts.
- Pass Arabic for
labeland the content; the frame has no words of its own.
Tokens
--soft, --ink-3 (label). Padding 20, radius 28 and gaps are fixed in CSS.
Accessibility
inertremoves everything inside from the tab order, pointer input and the accessibility tree;aria-disabled="true"marks the panel. So a disabled-looking button inside is never a keyboard trap.- Because the content is hidden from screen readers, say what it is outside it: the
ViewAsBannertext orlabel. - No text selection inside (
user-select: none).
Found in the source
- ARIA attributes set:
aria-disabled.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ViewAsBanner: the ink "You're viewing as …" bar with "Exit view" above it.RequestChallengeCard: the brand's Challenges card inside it, disabled withoutonRequest.PageGrid,Tile: the page inside.
See also: Banner · Card · Button · Accordion · HeroCard · KeyValue
Source
src/kit/patterns/ReadOnlyFrame.tsx (line 27) on GitHub.