shadcn.io is not affiliated with official shadcn/ui
Notes Composer Shortform Blog Block for React
A microblog feed with a composer: a Textarea with a 280-character ring and a Post note button that puts your note at the top, and five notes with a like toggle whose count rolls.
Installation
Overview
A short-form notes block for React with Base UI, written for Inkwick, a poet's microblog. A start-aligned header sits over a split behind a divider. At the start, a composer: a Textarea, a ring that fills as you type and turns into a count in the last twenty characters (280 at most), and a "Post note" Shine Button that is off while the note is empty or over the limit. At the end, the feed: five notes, each with its author as initials, a fixed date and a like Toggle whose count rolls to the new number. Posting puts your note at the top, marked "You", and keeps the newest seven. It's built from Textarea, CircularProgress, Shine Button, Toggle, SlidingNumber and Guides. Nothing is sent: notes and likes live in this page only and are gone on reload.
FAQ
Where does my note go?
Nowhere. It's added to the block's own state, shown first in the feed under the name "You" with the words "Just now", and lost on reload. A status line says so. To make it real, send the text to your server in the submit handler and prepend what comes back.
How does the 280-character limit work?
The ring fills with the length. In the last 20 characters a warning icon and the number of characters remaining appear (in a space reserved for them, so nothing shifts), and past the limit the number goes negative and Post note switches off. Screen readers hear it only at 20, 10, 0 and over, never on every keystroke.
How do the likes work?
Each like is a Toggle: pressed adds one to the note's base count and the number rolls to it; pressing again takes it back. The button's name says whose note it is, the first words and the count, and the rolling digits are hidden from assistive technology.
The toggle takes pressed and onPressedChange.
Where does focus go after posting?
Back to the text field, so you can write another note. The Shine Button is disabled while the field is empty, so it would otherwise lose the focus.
Related
- Pro
Numbered Rail Thread Blog
Story formatsA numbered thread: six parts hung on a vertical rail with their "1/6" chips, the author once at the top, the first four in view and a Show 2 more button that opens the last two.
- Pro
Comment Thread Blog
Reader feedbackA blog comment thread on hairline rows: top-level comments with initials avatars and fixed dates, replies in a Collapsible, and a form with an empty-submit check that adds your comment to the thread.
- Pro
Reaction Bar Blog
Reader feedbackA reaction bar under a review: five icon reactions with rolling counts in one raised strip, any number on at once, and a line that names the top reaction from the counts.
- Pro
Minimal Article Blog
Article partsOne article's opening and nothing else: a narrow reading measure with title, dek and byline, two paragraphs with a sunk initial, and a quiet Continue reading link.
- Pro
Composer Ring Social Platform Navbar
Calls to actionA navbar for a neighbourhood network: four links with an unread count, a profile avatar and a Create post button that opens a composer with a 280-character ring and a Post button that disables over the limit.
- Pro
Latest Posts Blog
Featured storyJust published: the newest post as a lead band in large type with a pulsing dot and a New mark, three earlier posts as rows with unread dots, and a Mark all as read button.