Build UI with Blok Design System
You are helping the user build UI components for a Sitecore Marketplace app using the Blok design system (Sitecore's shadcn-based component library).
Key Principles
- Always use Blok components — they match the Sitecore host UI and support light/dark themes automatically
- SDK data integration — use loading states (Skeleton) and error states (Alert) when fetching SDK data
- Extension point awareness — different extension types have different UI constraints (see below)
- Responsive — components render inside iframes of varying sizes
Installing Components
Blok components are installed via the shadcn CLI:
# Install the Blok theme (required first)
npx shadcn@latest add https://marketplace-sdk.sitecorecloud.io/r/blok-theme.json
# Install individual components
npx shadcn@latest add https://marketplace-sdk.sitecorecloud.io/r/<component-name>.json
See blok-components.md for the full component catalog with install commands.
UI Patterns by Extension Type
Compact Field (custom-field)
- Very limited space (~300px wide, variable height)
- Use: Input, Select, Badge, small inline components
- Avoid: Tables, large layouts, modals
Dashboard Widget
- Medium space (~400x300px default, resizable)
- Use: Cards, Charts, Stats, compact Tables
- Good for: Summary data, quick actions
Pages Context Panel
- Side panel (~350px wide, full height)
- Use: Vertical layouts, Lists, Accordion, Tabs
- Good for: Contextual info about current page, actions
Fullscreen
- Full viewport within the Sitecore shell
- Use: Any components, complex layouts, Tables, Forms
- Good for: Full CRUD interfaces, dashboards, settings
Standalone
- Independent page, not in Sitecore shell
- Use: Any components, full creative freedom
- Good for: Public-facing pages, OAuth callbacks
SDK Data Integration Pattern
"use client";
import { useEffect, useState } from "react";
import { useMarketplaceClient, useAppContext } from "@/components/providers/marketplace";
import { Skeleton } from "@/components/ui/skeleton";
import { Alert, AlertDescription } from "@/components/ui/alert";
export function MyComponent() {
const { client } = useMarketplaceClient();
const appContext = useAppContext();
const [error, setError] = useState<string | null>(null);
const loading = !appContext;
if (loading) return <Skeleton className="h-32 w-full" />;
if (error) return <Alert variant="destructive"><AlertDescription>{error}</AlertDescription></Alert>;
return <div>{/* Render data */}</div>;
}
Reference Files
- Blok Components — Full component catalog with install commands
1---2name: marketplace-build-component3description: Builds UI components using the Blok design system for Sitecore Marketplace apps. Use when the user wants to create UI, add components, build a page layout, or work with Blok/shadcn components in a marketplace app.4---56# Build UI with Blok Design System78You are helping the user build UI components for a Sitecore Marketplace app using the Blok design system (Sitecore's shadcn-based component library).910## Key Principles11121. **Always use Blok components** — they match the Sitecore host UI and support light/dark themes automatically132. **SDK data integration** — use loading states (Skeleton) and error states (Alert) when fetching SDK data143. **Extension point awareness** — different extension types have different UI constraints (see below)154. **Responsive** — components render inside iframes of varying sizes1617## Installing Components1819Blok components are installed via the shadcn CLI:2021```bash22# Install the Blok theme (required first)23npx shadcn@latest add https://marketplace-sdk.sitecorecloud.io/r/blok-theme.json2425# Install individual components26npx shadcn@latest add https://marketplace-sdk.sitecorecloud.io/r/<component-name>.json27```2829See [blok-components.md](references/blok-components.md) for the full component catalog with install commands.3031## UI Patterns by Extension Type3233### Compact Field (custom-field)34- Very limited space (~300px wide, variable height)35- Use: Input, Select, Badge, small inline components36- Avoid: Tables, large layouts, modals3738### Dashboard Widget39- Medium space (~400x300px default, resizable)40- Use: Cards, Charts, Stats, compact Tables41- Good for: Summary data, quick actions4243### Pages Context Panel44- Side panel (~350px wide, full height)45- Use: Vertical layouts, Lists, Accordion, Tabs46- Good for: Contextual info about current page, actions4748### Fullscreen49- Full viewport within the Sitecore shell50- Use: Any components, complex layouts, Tables, Forms51- Good for: Full CRUD interfaces, dashboards, settings5253### Standalone54- Independent page, not in Sitecore shell55- Use: Any components, full creative freedom56- Good for: Public-facing pages, OAuth callbacks5758## SDK Data Integration Pattern5960```tsx61"use client";6263import { useEffect, useState } from "react";64import { useMarketplaceClient, useAppContext } from "@/components/providers/marketplace";65import { Skeleton } from "@/components/ui/skeleton";66import { Alert, AlertDescription } from "@/components/ui/alert";6768export function MyComponent() {69 const { client } = useMarketplaceClient();70 const appContext = useAppContext();71 const [error, setError] = useState<string | null>(null);7273 const loading = !appContext;7475 if (loading) return <Skeleton className="h-32 w-full" />;76 if (error) return <Alert variant="destructive"><AlertDescription>{error}</AlertDescription></Alert>;7778 return <div>{/* Render data */}</div>;79}80```8182## Reference Files83- [Blok Components](references/blok-components.md) — Full component catalog with install commands