shadcn.io is not affiliated with official shadcn/ui
Centered Newsletter Archive Hero Block for React
A centered newsletter hero with an email signup that confirms in place, over the four latest issues as links in one hairline grid between the rails.
Installation
Overview
A centered hero with an inline newsletter signup and an archive of past issues, for React with Base UI. An announcement link points at the newest issue, then a headline, one sentence and an email form: its ShineButton shows a spinner while the request runs, then the form makes way for a confirmation. Below, a heading row with a link to the full archive sits over the four latest issues, laid out as cells of one hairline grid that runs from rail to rail, with + marks on its corners: four in a row, two by two on tablets and a single column on phones. Each cell is one link with its number, how long ago it went out, its title and a one-line summary. Built with Announcement, Badge, Status, Field, Input, Shine Button and Guides, with Lucide icons, Tailwind CSS and a CSS entrance that stays still under reduced motion. For writer newsletters, developer digests and product bulletins. The copy is for Fridayfile, a made-up weekly: replace it with your own.
FAQ
How do I put my own issues in the archive?
Edit the ISSUES array at the top of the file: each issue has a number, a title, a one-line description, an href and a published label. The labels are relative (This week, Last week, 2 weeks ago), so the demo never shows a stale date; when the issues come from your CMS or your newsletter provider, work the label out from each issue's send date as you render. Keep the count a multiple of four for the desktop row, and of two for the tablet grid.
How do I send the address to my newsletter provider?
subscribe checks the address, then sets status to loading, and a timer stands in for the request: after 1.2 seconds it sets status to done. Replace the timer with a call to your own endpoint, which adds the address with your provider's API, so no API key reaches the browser. Set done when it succeeds, and on a failure set status back to idle and error to a message, which shows under the field. Most providers send a confirmation email first (double opt-in), so the confirmation can say to check the inbox.
How does the form check the address?
The form has noValidate, so the browser's own bubble never shows, and subscribe checks the address itself when the form is sent. An empty field or an address without an @ and a domain shows a message under the field, the field is marked invalid (aria-invalid) and focus goes back to it; typing clears the message. The check only catches typos: your provider confirms the address is real.
What do screen readers hear when someone subscribes?
The field is labelled Email address (the label is visually hidden; the placeholder is only an example) and its error message is tied to it, so it's read with the field and announced when it appears. While the request runs the button keeps its name, Subscribe, and reports itself busy; its width doesn't change, since the spinner sits over the hidden label. When the confirmation replaces the form it takes focus, so the reader says You're subscribed instead of losing its place. Each issue is one link, read as its number, when it went out, its title and its summary.
How is the archive grid drawn?
The issues are a ul with gap-px bg-border: each li has a bg-background fill, so the 1px gaps show the border color as shared hairlines, with no double edges. The grid has a top and a bottom border and a Guides layer on its box that draws only the four + marks, so they land on the crossings with the rails. Cells tint on hover and show a focus ring inside the cell, so the ring isn't clipped by its neighbours.
How does the hero fit on a phone?
Below the sm breakpoint the email field and the button stack, each the form's full width, and the issues sit in one column. From sm up the field and the button share a row, and the issues form a two-by-two grid, and from lg a row of four. Titles and summaries wrap onto a second line rather than being cut short.
When should I use this archive hero instead of a plain signup hero?
Use it when you already have a backlog of issues: the archive shows what subscribers get and proves you send it every week. Before your first issue, or when the signup is the only thing you want visitors to do, use a plain signup hero such as the inline email signup.
Related
- Pro
Centered Inline Email Signup Hero
Signup and waitlistA short centered waitlist hero with an email field and a Shine Button on one row inside a framed box, a confirmation in place, an avatar row and two trust points.
- Pro
Centered Email Capture Form Hero
Signup and waitlistA compact centered newsletter hero with the email field in a full-width band between two hairlines: a Shine Button subscribes, then a confirmation replaces the form, over a row of subscriber proof.
- Pro
Centered Email Signup Hero
Signup and waitlistA compact centred hero built around one email field and a Shine Button, between solid rails, with a proof band below: the people on the list, when invites go out and what it connects to.
- Pro
Waitlist Signup Hero
Signup and waitlistA compact waitlist hero: the copy beside a card-in-card email form that turns into a confirmation in place, with a closing band of three features coming at launch.
- Pro
Changelog Preview Hero
Updates and timelinesA split hero for a code editor that releases on a schedule: the headline on one side, a ruled ledger of the four latest releases across a divider.
- Pro
Centered Activity Feed Hero
Stats and live dataA split hero with a live pill, a headline and two actions beside a ruled feed of recent activity, each row with an avatar, a name, an action and how long ago.