Blog grid
A blog index with a featured post, category filter, post cards, pagination and an in-place reader.
npx shadcn@latest add @silicon-ui/blog-gridInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/blog-gridManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/blocks/blog-grid/blog-grid.tsx
- components/silicon-ui/blocks/blog-grid/blog-grid-data.ts
- components/silicon-ui/blocks/blog-grid/blog-grid.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
BlogGrid
| Prop | Type | Default |
|---|---|---|
title | string | "Journal" |
description | string | "Product news, design notes and engineering deep dives from the team." |
posts | BlogPost[] | blogPosts |
categoriesCategory filter labels, in order. "All" is added in front. | string[] | blogCategories |
categoryActive category, or "All" (controlled). | string | — |
defaultCategory | string | "All" |
onCategoryChange | (category: string) => void | — |
pageOne based page (controlled). | number | — |
defaultPage | number | 1 |
onPageChange | (page: number) => void | — |
pageSizeCards per page below the featured post. Defaults to 6. | number | 6 |
showFeaturedShows the newest post of the current filter as a large card on page one. Defaults to true. | boolean | true |
getHrefLink for each post. When set, cards render as links and the in-place reader is off. | (post: BlogPost) => string | — |
onPostOpenCalled when a post opens, from a link or the in-place reader. | (post: BlogPost) => void | — |
className | string | — |
Dependencies
- npm
- lucide-reactmotion
- Registry
- silicon-motion-tokens