Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Directory Blog Block for React

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.

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

An alphabetical post index for React with Base UI, written for Atlasbook, a map lovers' blog. A split: at the start a short header and a polite line naming the last post opened; at the end, behind a divider, a framed command palette that lists twenty-four posts in groups by the letter their title starts with, only letters that have a post. Typing filters the titles, ignoring case and accents; the arrow keys move through the list, Enter opens the highlighted post and Escape clears the field. The foot counts what shows ("5 of 24 posts") and prints the keys. The palette keeps one height whatever you type. On a phone the palette comes straight after the header, and the key hints, which need a keyboard, are hidden. Opening a post records it in the line at the start, because a demo has nowhere to go; wire open to your router. It's built from Command, Kbd and Guides, with CSS for the entrance. For blogs, docs and archives with more posts than a menu can hold.

FAQ

How do I add my own posts?

Edit POSTS at the top of the file: an id, a title and the reading time in minutes. The list is sorted A to Z by title, the groups are the first letters that occur, and the count in the foot is derived, so nothing else needs touching. Twenty-four posts fill the palette about one and a half times; it scrolls inside its fixed height.

What does Enter do?

It opens the highlighted post, which here means the line at the start says "Opened: …", since a block with no router has nowhere to go. Replace open (or the onSelect of each item) with your router's navigation, or turn each item into a link. Clicking an item does the same as Enter.

How does the filter work, and does the palette jump?

The field matches the typed text anywhere in a title, ignoring case and accents, and groups with no match disappear. The palette has a fixed height and scrolls inside it, so filtering never moves the block; the count in the foot is a polite status ("5 of 24 posts") and an empty result says "No posts match." The list is built with cmdk's own filtering turned off, so the block's matching (case and accents ignored) decides which items show.

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

The field is a combobox over a list: focus stays in the field, Up and Down move the highlight, Enter opens and Escape clears the typed text. Groups are labelled by their letter. The foot's count and the opened-post line are polite statuses. The palette does not take focus when the page loads.

How does it fit on a phone?

The header, then the palette at full width, then the opened-post line. The key hints are hidden on a phone, where there is no keyboard; the list scrolls inside the palette and the field's keyboard opens as usual. Nothing scrolls the page sideways at 320 pixels.

Does it work right to left?

Yes. The split, the palette and the list mirror, group letters keep their place, and reading times are isolated so "8 min" stays in order.

  • Pro

    A developer-tools blog behind a search field: a slash shortcut focuses it, typing keeps the posts whose title or summary holds the words and marks them, and six cells draw tiny tool windows as covers.

  • Pro

    Categories Blog

    Topics and indexes

    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.

  • 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 farm journal's archive as a nested accordion, years that open to months and months that open to posts, with counts worked out from the posts and an Expand all control.

  • Pro

    A FAQ for a docs host with a working command palette: a search-field button with its shortcut opens a palette of questions by topic, and choosing one opens its row below.

  • Pro

    A navbar for a notes app with a field-looking button and a shortcut that open a command palette: recent notes first, then pages, actions and settings in labelled groups, with the keys that work shown beside each row.