Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Categories Blog Block for React

A houseplant magazine's category index: seven cells on shared hairlines, each a link with an icon ring, a scope, the latest post, a post count and a bar for its share, derived from the list of posts.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A category index for React with Base UI, written for Leafhollow, a houseplant magazine. A centred header sits over seven cells that share their hairlines from rail to rail and end the block. Six are topics: each is one link, the name, with an icon ring, a one-line scope, the title of its latest post, its post count and a bar showing its share of everything published. The counts, the shares and the latest titles are derived from the typed list of posts, the shares are rounded so they add up to 100, and the biggest topic spans two columns. A seventh cell links to every post. Each cell wears a small drawn swatch in its corner, a line pattern the category owns. One column on a phone, two on a tablet, three on a desktop. It's built from Guides with Lucide icons, with CSS for the entrance and the hover. For magazines and blogs with a handful of topics.

FAQ

How do I add posts and categories?

Edit POSTS (every post, newest first, with its category and title) and CATEGORIES (a name, an icon and a one-line scope) at the top of the file. Counts, shares, the ranking and each cell's latest title are derived, so adding a post changes the numbers and the bars. A new category also needs a swatch in SWATCHES and its name in the Name type. The grid is built for six topics plus the All cell: with another count, check the spans so no slot is left empty.

Why do the shares add up to 100?

Each share is rounded by the largest-remainder method: every category gets its whole percentage, and the points left over go to the categories with the biggest fractions. The bars use the same numbers as the text, so the two never disagree by a point.

Why does the biggest cell span two columns?

The categories are ranked by post count, and the first spans two columns from sm up, so the grid says which topic the magazine writes about most. The All cell takes the slots that remain, which is what keeps every row full on a hairline grid: an empty slot would show the border colour.

How does it work with a keyboard and a screen reader?

Each cell is one link, its category name, and the link covers the whole cell with its focus ring drawn inside it. The icon, the swatch and the bar are decoration and hidden from assistive technology; the count and the share are text. Tab visits the seven links in reading order.

How does it fit on a phone?

One column of seven cells, about two and a half screens. Each cell keeps its scope, latest title, count and bar. Nothing scrolls sideways at 320 pixels.

Does it work right to left?

Yes. The grid, the corner swatch and the bar's fill start at the start edge, and counts and percentages are isolated with bdi, so "28% of all posts" keeps its order. The swatches are artwork and never mirror.

  • Pro

    Tag Cloud Blog

    Topics and indexes

    A foraging blog's tag cloud: fourteen tags in five sizes derived from their post counts, each a toggle that lists its three latest posts in a fixed-height panel beside the cloud.

  • Pro

    A coffee journal's archive with a ruled band of category chips and their counts over eight post cells: choosing a chip removes the other posts, a polite line says how many show, and the wall keeps its height.

  • Pro

    Directory Blog

    Topics and indexes

    A map blog's A to Z index as a framed command palette: twenty-four posts grouped by the letter they start with, a filter field, arrow keys, a count and key hints at the foot.

  • Pro

    Cards Grid Blog

    Card grids

    The 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.

  • Pro

    A reading layout: five post rows with small drawn route maps at the start, and behind a divider a sidebar of topics with counts, a numbered most-read list and the archive by year.

  • Pro

    A bento of five features for an issue tracker, each cell drawn as the product at work: a live board with teammates' cursors, a pull request, a burndown, a triage rule and a typed SDK, in cells that share their hairlines.