@@ -3,6 +3,8 @@ title: "Block Schema (BlockSchema)"
33description : " Reusable component blocks with variables, slots, and marketplace support"
44---
55
6+ import { InteractiveDemo , DemoGrid } from ' @/app/components/ComponentDemo' ;
7+
68# Block Schema
79
810The ` BlockSchema ` defines reusable component blocks that can be configured with variables, support content injection through slots, and shared via a marketplace.
@@ -17,6 +19,143 @@ BlockSchema enables:
1719- ** Marketplace support** - Share and discover blocks
1820- ** Version control** - Track block versions
1921
22+ ## Interactive Examples
23+
24+ ### Feature Card Block
25+
26+ <InteractiveDemo
27+ title = " Feature Card Block"
28+ description = " A reusable block with configurable icon, title, description, and CTA button"
29+ schema = { {
30+ type: " card" ,
31+ className: " max-w-sm mx-auto" ,
32+ children: [
33+ {
34+ type: " stack" ,
35+ spacing: 4 ,
36+ className: " items-center text-center p-4" ,
37+ children: [
38+ {
39+ type: " div" ,
40+ className: " w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center" ,
41+ children: [{ type: " icon" , name: " zap" , className: " h-6 w-6 text-primary" }]
42+ },
43+ { type: " text" , content: " Fast Performance" , className: " text-lg font-semibold" },
44+ { type: " text" , content: " Lightning-fast response times with optimized bundle sizes and edge caching support." , className: " text-sm text-muted-foreground" },
45+ { type: " button" , label: " Learn More" , variant: " outline" , size: " sm" }
46+ ]
47+ }
48+ ]
49+ }}
50+ />
51+
52+ ### Block Variations
53+
54+ <InteractiveDemo
55+ title = " Block with Variable Overrides"
56+ description = " The same block template rendered with different variable values"
57+ examples = { [
58+ {
59+ label: " Security Feature" ,
60+ schema: {
61+ type: " card" ,
62+ className: " max-w-sm" ,
63+ children: [
64+ {
65+ type: " stack" ,
66+ spacing: 3 ,
67+ className: " items-center text-center p-4" ,
68+ children: [
69+ { type: " div" , className: " w-12 h-12 rounded-lg bg-green-500/10 flex items-center justify-center" , children: [{ type: " icon" , name: " shield" , className: " h-6 w-6 text-green-600" }] },
70+ { type: " text" , content: " Enterprise Security" , className: " text-lg font-semibold" },
71+ { type: " text" , content: " Bank-grade encryption and SOC 2 compliance built in." , className: " text-sm text-muted-foreground" },
72+ { type: " button" , label: " See Certifications" , variant: " outline" , size: " sm" }
73+ ]
74+ }
75+ ]
76+ }
77+ },
78+ {
79+ label: " Analytics Feature" ,
80+ schema: {
81+ type: " card" ,
82+ className: " max-w-sm" ,
83+ children: [
84+ {
85+ type: " stack" ,
86+ spacing: 3 ,
87+ className: " items-center text-center p-4" ,
88+ children: [
89+ { type: " div" , className: " w-12 h-12 rounded-lg bg-purple-500/10 flex items-center justify-center" , children: [{ type: " icon" , name: " chart-column" , className: " h-6 w-6 text-purple-600" }] },
90+ { type: " text" , content: " Advanced Analytics" , className: " text-lg font-semibold" },
91+ { type: " text" , content: " Real-time dashboards and custom report builder included." , className: " text-sm text-muted-foreground" },
92+ { type: " button" , label: " View Demo" , variant: " outline" , size: " sm" }
93+ ]
94+ }
95+ ]
96+ }
97+ }
98+ ]}
99+ />
100+
101+ ### Block Marketplace Card
102+
103+ <InteractiveDemo
104+ title = " Block Marketplace Listing"
105+ description = " How blocks appear in the marketplace with metadata and ratings"
106+ schema = { {
107+ type: " card" ,
108+ className: " max-w-md mx-auto" ,
109+ children: [
110+ {
111+ type: " div" ,
112+ className: " h-32 bg-gradient-to-br from-blue-500/20 to-purple-500/20 rounded-t-lg flex items-center justify-center" ,
113+ children: [{ type: " icon" , name: " layout-template" , className: " h-12 w-12 text-primary/60" }]
114+ },
115+ {
116+ type: " stack" ,
117+ spacing: 3 ,
118+ className: " p-4" ,
119+ children: [
120+ {
121+ type: " flex" ,
122+ className: " items-start justify-between" ,
123+ children: [
124+ {
125+ type: " stack" ,
126+ spacing: 1 ,
127+ children: [
128+ { type: " text" , content: " Pricing Table Pro" , className: " font-semibold" },
129+ { type: " text" , content: " by ObjectUI Team" , className: " text-xs text-muted-foreground" }
130+ ]
131+ },
132+ { type: " badge" , label: " v2.1.0" , variant: " secondary" }
133+ ]
134+ },
135+ { type: " text" , content: " Professional pricing comparison table with toggle for monthly/yearly billing." , className: " text-sm text-muted-foreground" },
136+ {
137+ type: " flex" ,
138+ className: " gap-2 flex-wrap" ,
139+ children: [
140+ { type: " badge" , label: " Marketing" , variant: " outline" },
141+ { type: " badge" , label: " SaaS" , variant: " outline" },
142+ { type: " badge" , label: " Pricing" , variant: " outline" }
143+ ]
144+ },
145+ {
146+ type: " flex" ,
147+ className: " items-center justify-between pt-2 border-t" ,
148+ children: [
149+ { type: " text" , content: " ★ 4.9 (234 ratings) · 5.4k installs" , className: " text-xs text-muted-foreground" },
150+ { type: " button" , label: " Install" , variant: " default" , size: " sm" }
151+ ]
152+ }
153+ ]
154+ }
155+ ]
156+ }}
157+ />
158+
20159## Basic Usage
21160
22161``` plaintext
@@ -127,7 +266,7 @@ const cardBlock: BlockSchema = {
127266 label: 'Feature Card',
128267 description: 'A card component for highlighting product features',
129268 category: 'Marketing',
130- icon: 'Box ',
269+ icon: 'box ',
131270 tags: ['card', 'feature', 'marketing', 'product'],
132271 author: 'ObjectUI Team',
133272 version: '1.0.0',
@@ -157,9 +296,9 @@ const cardBlock: BlockSchema = {
157296 name: 'icon',
158297 label: 'Icon',
159298 type: 'string',
160- defaultValue: 'Star ',
299+ defaultValue: 'star ',
161300 description: 'Lucide icon name',
162- enum: ['Star ', 'Heart ', 'Check ', 'Zap ', 'Shield ']
301+ enum: ['star ', 'heart ', 'check ', 'zap ', 'shield ']
163302 },
164303 {
165304 name: 'variant',
@@ -269,7 +408,7 @@ const instance: BlockInstanceSchema = {
269408 values: {
270409 title: 'Fast Performance',
271410 description: 'Lightning-fast response times',
272- icon: 'Zap ',
411+ icon: 'zap ',
273412 variant: 'filled',
274413 showButton: true,
275414 buttonText: 'See Benchmarks'
@@ -364,7 +503,7 @@ const marketplace: BlockLibrarySchema = {
364503 label: 'Pricing Table Pro',
365504 description: 'Professional pricing comparison table',
366505 category: 'Marketing',
367- icon: 'DollarSign ',
506+ icon: 'dollar-sign ',
368507 tags: ['pricing', 'saas', 'comparison'],
369508 author: 'ObjectUI Team',
370509 version: '2.1.0',
0 commit comments