Official Registry Host
Shadcn Custom Registry
Every ButterflyPress visual block is distributed as a pure CSS-tokenized Shadcn Registry item at symmetric
/r/{framework}/{name}.json endpoints (/r/astro/{name}.json,
/r/react/{name}.json, and /r/vue/{name}.json).
@butterflypress/cli installs blocks Offline-First from
@butterflypress/registry by default, and supports --remote for live HTTP fetches via
shadcn.
Initialize & Install Blocks (Offline-First + Remote) bash
# Astro (Offline-First default)
npx @butterflypress/cli init --framework astro
npx @butterflypress/cli add hero feature-cards
# React / Next.js
npx @butterflypress/cli init --framework react
npx @butterflypress/cli add hero card --framework react
# Vue 3 / Nuxt
npx @butterflypress/cli init --framework vue
npx @butterflypress/cli add hero card --framework vue
# Force HTTP fetch from https://butterflypress.io/r/{framework}/{name}.json via shadcn
npx @butterflypress/cli add hero --framework astro --remote Hero Section
High-impact landing hero with split/centered layout, CTA actions, media, and key statistics.
Install Command (Offline-First)
Add --remote to fetch via HTTPnpx @butterflypress/cli add hero
Public Registry Endpoint
Dependencies:@butterflypress/core@butterflypress/astro
Source (components/blocks/Hero.astro)
---
import BpImage from "@butterflypress/astro/primitives/BpImage.astro"
import BpRichText from "@butterflypress/astro/primitives/BpRichText.astro"
import BpAction from "@butterflypress/astro/primitives/BpAction.astro"
import type { StreamBlock } from "@butterflypress/core"
interface Props {
block?: StreamBlock
value?: any
settings?: any
components?: Record<string, any>
apiBaseUrl?: string
localizePath?: (path: string) => string
}
const { block, value: rawValue, apiBaseUrl, localizePath } = Astro.props
const value = rawValue || block?.value || {}
const title = value?.title || value?.heading
const subtitle = value?.subtitle || value?.description || value?.body || value?.text
const eyebrow = value?.eyebrow || value?.badge
const media = value?.image || value?.media
const actions = Array.isArray(value?.actions || value?.buttons)
? value.actions || value.buttons
: value?.cta
? [value.cta]
: []
const stats = Array.isArray(value?.stats) ? value.stats : []
const layout = value?.layout || "split" // "split" | "centered"
---
<section data-bp-section="hero" class="relative py-16 md:py-24 overflow-hidden bg-background text-foreground">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
{
layout === "centered" ? (
<div class="text-center max-w-3xl mx-auto">
{eyebrow && (
<div class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold tracking-wide uppercase bg-primary/10 text-primary mb-4">
{eyebrow}
</div>
)}
{title && <h1 class="text-4xl md:text-6xl font-extrabold tracking-tight mb-6">{title}</h1>}
{subtitle && (
<div class="text-lg md:text-xl text-muted-foreground leading-relaxed mb-8">
<BpRichText html={subtitle} localizePath={localizePath} />
</div>
)}
{actions.length > 0 && (
<div class="flex flex-wrap justify-center gap-4 mb-12">
{actions.map((act: any, idx: number) => (
<BpAction
action={act}
localizePath={localizePath}
class={`px-6 py-3 rounded-lg text-sm font-semibold transition-all ${
idx === 0
? "bg-primary text-primary-foreground hover:opacity-90 shadow-md"
: "bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-border"
}`}
/>
))}
</div>
)}
{media && (
<div class="rounded-2xl border border-border overflow-hidden shadow-2xl">
<BpImage image={media} apiBaseUrl={apiBaseUrl} class="w-full h-auto object-cover max-h-[500px]" />
</div>
)}
</div>
) : (
<div class="grid grid-cols-1 lg:grid-cols-2 gap-12 lg:gap-16 items-center">
<div>
{eyebrow && (
<div class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold tracking-wide uppercase bg-primary/10 text-primary mb-4">
{eyebrow}
</div>
)}
{title && <h1 class="text-4xl md:text-5xl lg:text-6xl font-extrabold tracking-tight mb-6">{title}</h1>}
{subtitle && (
<div class="text-lg text-muted-foreground leading-relaxed mb-8">
<BpRichText html={subtitle} localizePath={localizePath} />
</div>
)}
{actions.length > 0 && (
<div class="flex flex-wrap gap-4 mb-8">
{actions.map((act: any, idx: number) => (
<BpAction
action={act}
localizePath={localizePath}
class={`px-6 py-3 rounded-lg text-sm font-semibold transition-all ${
idx === 0
? "bg-primary text-primary-foreground hover:opacity-90 shadow-md"
: "bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-border"
}`}
/>
))}
</div>
)}
{stats.length > 0 && (
<div class="grid grid-cols-2 sm:grid-cols-3 gap-6 pt-6 border-t border-border">
{stats.map((st: any) => (
<div>
<div class="text-2xl md:text-3xl font-extrabold text-foreground">{st.value || st.number}</div>
<div class="text-xs text-muted-foreground mt-1">{st.label || st.text}</div>
</div>
))}
</div>
)}
</div>
{media && (
<div class="relative">
<div class="rounded-2xl border border-border overflow-hidden shadow-2xl">
<BpImage image={media} apiBaseUrl={apiBaseUrl} class="w-full h-[400px] md:h-[500px] object-cover" />
</div>
</div>
)}
</div>
)
}
</div>
</section>