Markdown Code Block
A terminal-style code block rendering each question as a ## markdown heading in monospace type, followed by its answer as plain text, mimicking how a FAQ would read inside a project's README or docs file.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/markdown-code-block.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq40.tsx instead.
Usage
The file also exports faq40Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Faq40, faq40Demo } from "@/components/blocks/faq/faq40"; export default function Page() { return <Faq40 {...faq40Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| fileName | string | "FAQ.md" | File name shown in the mock window header. |
| heading | string | none | Optional section heading above the code block. |
| description | string | none | Optional supporting copy under the heading. |
| items | DocFaqItem[] | none | List of questions and answers rendered as markdown-style entries. |
| className | string | none | Extra classes for the outer section element. |
Types
interface DocFaqItem { question: string; answer: string; }
Behavior notes
- Plain server component; no real markdown parsing happens, the ## prefix and monospace styling are purely visual to evoke a docs file.
- The dark bg-neutral-950 palette is a deliberate one-off exception to the site's semantic-token rule, used here specifically for the terminal/code aesthetic the brief calls for.
- The three header dots are decorative window-chrome only, not real window controls, and the content area scrolls independently once it exceeds its max height.
More FAQ Blocks
View all →collapsible-accordion
Collapsible Accordion
Stacked cards with expandable sections, for full-length answers in a compact format.
open-list-layout
Open List Layout
Questions with answers displayed directly below in a simple always-open list.
three-column-grid
Three Column Grid
Q&A pairs arranged in a responsive grid layout, always open.
tabbed-categories
Tabbed Categories
Sidebar navigation with category tabs and an accordion of that category's questions.
searchable-accordion
Searchable Accordion
Search input that filters accordion items in real-time by question and answer text.
grouped-sections
Grouped Sections
FAQs organized into titled sections, each with its own independent accordion below it.