contentbit
componentastro-content-renderersource: ok · refreshed
Content Renderer (Astro)
Renders a validated Content Blocks document with the styled component pack.
npx shadcn add "https://contentbit.dev/r/astro-content-renderer.json"free
No selection tags yet — empty means no evidence, not lack of support.
Dependencies
Bundle weight · light@contentbit/core@contentbit/blocks@contentbit/astro
Registry dependencies
@contentbit/astro-callout@contentbit/astro-steps@contentbit/astro-key-metrics@contentbit/astro-quick-ref@contentbit/astro-comparison@contentbit/astro-pros-cons@contentbit/astro-tabs@contentbit/astro-faq
Files1 · source cached 10/8/2026, 4:20:19 AM
src/astro/content-renderer.astro
---
import type { ProcessedDocumentNode } from '@contentbit/core'
import type { ComponentProps } from 'astro/types'
import { ContentBlocks } from '@contentbit/astro/components'
import Callout from './callout.astro'
import Comparison from './comparison.astro'
import Faq from './faq.astro'
import KeyMetrics from './key-metrics.astro'
import ProsCons from './pros-cons.astro'
import QuickRef from './quick-ref.astro'
import Steps from './steps.astro'
import Tabs from './tabs.astro'
// The styled pack, keyed by block name. Add your custom blocks via the
// `components` prop — they merge over these.
const styledComponents: Record<string, unknown> = {
callout: Callout,
steps: Steps,
'key-metrics': KeyMetrics,
'quick-ref': QuickRef,
comparison: Comparison,
'pros-cons': ProsCons,
tabs: Tabs,
faq: Faq,
}
interface Props {
document: ProcessedDocumentNode
components?: Record<string, unknown>
/**
* Host prose pipeline for Markdown between block islands and nested block
* children. Pass your Astro/Satteri renderer here if the rest of your site
* uses Astro's Markdown processor.
*/
renderMarkdown?: ComponentProps<typeof ContentBlocks>['renderMarkdown']
onInvalid?: 'strict' | 'annotated' | 'fallback'
}
const { document, components, renderMarkdown, onInvalid } = Astro.props
---
<ContentBlocks
document={document}
components={{ ...styledComponents, ...components }}
renderMarkdown={renderMarkdown}
onInvalid={onInvalid}
/>