Skip to Content
BBRICKSv0.7.4
KitPatterns

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.

Pinned to TRNDR preset
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&apos;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

  1. Wrapper (only with label): .kit-ro-wrap, a grid, 8px gap.
  2. 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.").
  3. Panel: <div class="kit-ro" inert aria-disabled="true">: grid with 16px gap, padding 20, radius 28, --soft background, pointer-events: none, no text selection.
  4. Children: the page shown, usually PageGrids of tiles and cards.

Variants

Prop valueLookWhen to use
no labelPanel onlyA banner above already says what it is (ViewAsBanner).
labelA muted line above the panelNothing above explains it; the line stays readable by screen readers.

States

StateHow
Read onlyAlways: the panel is inert (set on the node by a ref callback, since React 18 has no inert prop).
Label added or removedChanging 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

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 label when 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 / busy states.
  • Don't nest a second ReadOnlyFrame inside it.

RTL and Arabic

  • The content mirrors as it would on its own page; the panel has no direction-specific parts.
  • Pass Arabic for label and 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

  • inert removes 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 ViewAsBanner text or label.
  • 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.

See also: Banner · Card · Button · Accordion · HeroCard · KeyValue

Source

src/kit/patterns/ReadOnlyFrame.tsx (line 27) on GitHub.

On this page