shadcn.io is not affiliated with official shadcn/ui
Read-Only Document Error Block for React
A full-screen read-only page for a document editor: a drawn page with a lock above a table of six actions (allowed or not, and the role each needs), Request edit access that opens a message to the owner in place, and Open in read mode.
Installation
Overview
Tell people what they can still do, and how to ask for more, with this read-only page for React with Base UI. It's the view-mode screen of Foliocraft, a document editor: a whole screen with the page's rails and one band across it, its content a start-aligned column. Under the heading, one frame ruled by shared hairlines holds a drawn page with a lock on it, in greyscale, and a native table of six actions: View, Download and Comment allowed; Edit, Share and Change permissions not allowed, each as a word with a shape and the role it needs (the last column is dropped on a phone). The frame's corners come from Guides. A Shine Button Request edit access opens a message to the owner in place, with a Textarea in a Field and a Button Send request that records it; an outline link, Open in read mode, stays beside it. It's built from Textarea, Field, Shine Button, Button and Guides, with a CSS entrance only. For any editor with sharing roles.
FAQ
What does Send request do, and what stays in the page?
It checks that the message says something (an empty one is named under the field and focused), then records the request in the page's state and says "Recorded in this demo. Lenka Hartwood would get it by email. Nothing was sent." The same button then reads Withdraw request and takes it back. To wire it for real, post the message to the document's owner where the code says so, and show the pending state from the response.
Where do the six actions come from?
From the typed list ACTIONS: a name, whether the visitor can, and the role it needs. The count in the heading ("3 of 6 allowed") is derived from the same list. State is a word and a shape (a check or a dash), never only a colour. The table is a native one with a caption, column headers and row headers, so a screen reader reads each action with its answer.
Why does the request open in place, and why does the page start at the top?
Because it keeps the visitor on the page they were reading. The request folds open under the buttons by animating the row height (not at all with reduced motion); while folded it is invisible and inert, so nothing in it takes focus, and what you typed is kept. Opening it makes the page taller, so the page starts at the top rather than the middle: a centred page would move its headline.
What changes on a phone?
The drawn page and its caption sit side by side to save height, the Needs column is dropped, and the two buttons are pinned to the foot of the screen until you reach them. Request edit access is the only coloured control in both layouts.
Related
- Pro
Role Ladder Permission Denied Error
Locked and removedA full-screen permission page for a design-system manager: a role ladder of four rising steps with you at Viewer and Admin marked as needed, 'Two roles up' in words, and a Request access dialog that records a note and an owner in local state.
- 43Pro
403 Forbidden Error
Locked and removedA full-screen 403 page for a team wiki: a door drawn as the zero of 403, the heading 'Ask someone who can say yes', the three workspace admins in a framed list with a Copy email button each, and a way back to the wiki.
- Pro
Archived Project Restore Error
Locked and removedA page for an archived project: four cells for when and by whom it was archived, how many people worked on it and how many days it sat quiet, a retention meter with the months that remain, one button to restore it, a real archive download and a link to active projects.
- Pro
Seats Full Error
Plans and checkoutA panel for an invite that can't go out because every seat is taken: six seat cells, two inactive members to remove, and one button that reads Add seats until a seat is free and then Send the invite.
- Pro
Sync Conflict Error
Files and dataA panel for two people who changed the same document: ruled rows for the fields that differ, each with Yours and Theirs as native radio cells, a Keep all toggle, a merged result that rebuilds as you choose, and the unchanged fields in a collapsible.
- Pro
Account Deleted Error
Locked and removedA full-screen page for someone who signs in to a deleted account: three facts on shared hairlines and two choice cells that spell out what recovering and starting fresh each mean, with a Shine Button that follows the choice.