shadcn.io is not affiliated with official shadcn/ui
Carousel Blog Block for React
Eight posts in a multi-up carousel of cells with overshoot, each leading with a drawn instrument face; a count and previous and next buttons sit in the heading row.
Installation
Overview
A post carousel for React with Base UI, written for Fieldcraft, a surveying-tools blog. Eight posts sit in a row of cells with overshoot, one on a phone, two on a tablet and three on a desktop, with the next post cut off at the end as the cue to scroll. Each cell leads with a small drawn instrument face (a level vial, a compass rose, a dial gauge, a contour map, a measuring tape) in your theme's tokens, then the category, the title as the cell's one link, a short dek and a byline. The heading row holds a "1–3 of 8" count and previous and next buttons that wrap around; the arrow keys turn the posts too, and nothing plays by itself. Posts out of view are removed from the tab order and from the reading. It's built from Guides, Carousel, Badge, Avatar and Button, with CSS for the entrance and the hover. For engineering blogs, product journals and any list of posts that should fit one row.
FAQ
How do I add my own posts?
Edit POSTS at the top of the file. Each post has a title, a one-line dek, an author, a category, a date as an ISO string, a reading time in minutes, an href, a cover and a reading (what the instrument shows). The count, the screen-reader announcement and the slide names are all computed from the list, so any number of posts works.
How does the keyboard work?
Tab reaches the previous and next buttons and then the visible posts' titles; the posts out of view are inert, so Tab never lands on one you can't see. The arrow keys move the carousel by one post, and in a right-to-left page the arrows follow the reading direction, so the end arrow always goes forward. A key pressed on a post's title hands focus to the previous or next button, because that post may have just left the page. The buttons wrap around at the ends, so one never disables while it has focus. A polite status line announces "Showing posts 2 to 4 of 8" for screen readers.
What does the count show?
The posts in full view: "1–3 of 8" on a desktop, "1–2 of 8" on a tablet and "1 of 8" on a phone. It is recomputed from the screen width and the current page.
What is it built on?
The catalog Carousel, which is Embla: the block reads its snap list, sets the slide width with basis-* classes, and replaces the arrow-key handling so it follows the page's direction.
How are the instrument covers drawn?
Each is one SVG at the cover's proportions, built from circles, ticks and a needle or a bubble whose position comes from the post's reading; every stroke stays a hairline at any size and every colour is a theme token, with one foreground chip for the reading. They are artwork, so a right-to-left page never mirrors them.
Related
- Pro
Masonry Wall Blog
Card gridsEight posts in staggered CSS columns, each cell leading with a drawn pattern cover in a poster, square or wide shape; six show on a phone behind a More posts button.
- Pro
Cards Grid Blog
Card gridsThe six latest posts of an engineering blog as cards on shared hairlines: drawn greyscale covers, a category, the title as the card's one link, a one-line dek and a byline with the date and reading time.
- 1425Pro
Trending Posts Blog
Post listsSix ranked stories in two columns of three on shared hairlines, each with a huge outline numeral and its move since last week, as an arrow and a number.
- Pro
Series Deck Grid Blog
Card gridsSix series as decks: each cell draws three offset covers, the series title as one link, a status badge and a thin bar with how far you have read, with a toggle group that filters All, In progress and Finished without moving the page.
- Pro
Card Carousel Features
Carousels and mediaA multi-up carousel of seven capability cards for a product-tour builder, each led by a greyscale drawing, with the next card cut off at the rail and previous and next buttons in the heading row.
- Pro
Quote Carousel Testimonials with Next-Speaker Preview
Carousels and decksA centred, looping carousel of large customer quotes in a card in a card, whose Previous and Next buttons preview who speaks next, with the neighbour's avatar and first name.