shadcn.io is not affiliated with official shadcn/ui
Drafts Desk Blog Block for React
A drafts list for a writing-tools blog: each row has a status badge, a progress bar with its word count, the fixed time it was edited and a menu to edit, duplicate or archive it.
Installation
Overview
A drafts desk for React with Base UI, written for Fairleaf, a blog about tools for writers. A start-aligned header sits over a count band and five drafts as rows that run from rail to rail. Each row has the title, a status Badge (Outline, Drafting or Needs edit), the author, a Progress bar with "1,240 of 1,800 words", the fixed time it was last edited, and a menu with Edit, Duplicate and Archive. Duplicate puts a copy at the top, Archive takes the row away and turns on Undo archive, and Edit only says what it would do. It's built from Badge, Progress, DropdownMenu, Button and Guides. Nothing is saved in this demo: the changes live in this page and a reload brings the five drafts back. Word counts and edit times are example data.
FAQ
What do the menu items really do?
They change the block's own state and say so. Duplicate adds a copy titled "(copy)" at the top, with the Outline status and no words. Archive removes the row and enables Undo archive, which puts it back where it was. Edit changes nothing and says it would open the draft in the editor. A polite status line under the count reads each result, and nothing is saved in this demo.
Where does the count come from?
It is worked out from the rows: "5 drafts, 2 need an edit" counts the drafts shown and the ones with the Needs edit status, so it changes when you duplicate or archive. The progress bars and the percentage come from each draft's words and target.
How is the status shown without colour?
Each status has a word and an icon (a list, a pencil, a flag) and the three differ in weight, not hue: Drafting is a filled neutral badge and the other two are outlined. The bars use the foreground colour on a neutral track.
How do the menu and the keyboard work?
Each row's three-dot button is named for its draft ("Actions for ..."), opens with Enter or Space, moves with the arrow keys and closes with Escape.
Each item takes onClick.
Related
- Pro
Vote Board Roadmap Blog
Reader feedbackUpcoming posts as numbered rows: a vote toggle with a rolling count, the title and what it will argue, and a drawn four-segment stage meter from Researching to Scheduled.
- Pro
Diff Revision History Blog
Stats and draftsThe revision history of one post: five revisions as a radio group at the start, and at the end a framed word-by-word diff of the lede with inserted and deleted marks for the chosen revision.
- Pro
Compact List Blog
Post listsTwenty posts as dense one-line rows like a printed contents page: date, title, a dotted leader and the reading time, eight shown and twelve behind a Show more button.
- Pro
Reading Time Blog
Reading toolsPosts by length with a reading-speed Slider: every post shows its words, a length bar against the longest post and the minutes it takes at your speed, with a total that recalculates as you move the slider.
- Pro
Reading List Blog
Reading toolsFive saved articles with a bookmark toggle on each: un-saving strikes the row through in place with an Undo link, and the foot reads the derived totals, like 5 saved, 46 min to read.
- Pro
Notes From The Desk Changelog Blog
Story formatsThe publication's own changes written as posts: entries with a large version numeral and date at the start, grouped Added, Changed and Fixed lists, and Show earlier notes in a Collapsible.