Aurora AI Schema Display
aurora-dinglebear-ai/aurora-ai-schema-displayFreeBlock
Aurora-native schema display parity surface from AI Elements.
Install it
npx shadcn@latest add https://aurora.dinglebear.ai/r/aurora-ai-schema-display.jsonSource
1"use client"23import * as React from "react"4import { Code } from "lucide-react"5import { cn } from "@/lib/utils"6import { Badge } from "@/registry/aurora/ui/badge"78// ---------------------------------------------------------------------------9// Types10// ---------------------------------------------------------------------------1112export interface JsonSchemaProperty {13 type?: string14 description?: string15 items?: { type?: string }16 [key: string]: unknown17}1819export interface JsonSchema {20 type?: string21 required?: string[]22 properties?: Record<string, JsonSchemaProperty>23 [key: string]: unknown24}2526export interface SchemaDisplayProps extends React.HTMLAttributes<HTMLDivElement> {27 /** JSON Schema object to render. */28 schema: JsonSchema | unknown29 /** Header title shown beside the code glyph. */30 title?: string31 /** Initial view tab. Defaults to "fields". */32 defaultView?: "fields" | "json"33}3435// ---------------------------------------------------------------------------36// Type-tone mapping — each JSON-schema scalar maps to an Aurora status tone.37// Array/string -> success, integer/number -> warn, boolean -> rose.38// ---------------------------------------------------------------------------3940type TypeTone = {41 badge: "info" | "success" | "warn" | "rose"42}4344function toneForType(type: string): TypeTone {45 const base = type.replace(/\[\]$/, "")46 switch (base) {47 case "integer":48 case "number":49 return {50 badge: "warn",51 }52 case "boolean":53 return {54 badge: "rose",55 }56 case "object":57 return {58 badge: "info",59 }60 // string, array (string[]), and anything else → success teal61 default:62 return {63 badge: "success",64 }65 }66}6768function displayType(prop: JsonSchemaProperty): string {69 if (prop.type === "array") {70 const itemType = prop.items?.type ?? "any"71 return `${itemType}[]`72 }73 return prop.type ?? "any"74}7576// ---------------------------------------------------------------------------77// Raw JSON renderer (token-colored, mono).78// ---------------------------------------------------------------------------7980function renderJsonValue(value: unknown, depth = 0): React.ReactNode {81 const indent = " ".repeat(depth)8283 if (Array.isArray(value)) {84 if (value.length === 0) return <span style={{ color: "var(--aurora-text-muted)" }}>[]</span>85 return (86 <>87 <span style={{ color: "var(--aurora-text-muted)" }}>[</span>88 {"\n"}89// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aurora
All 176 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aurora AI Actionaurora-ai-action | aurora | Blocks | Free | 1 dep | |
| Aurora AI Actionsaurora-ai-actions | aurora | Blocks | Free | 1 dep | |
| Aurora AI Agentaurora-ai-agent | aurora | Blocks | Free | 1 dep | |
| Aurora AI Image Gridaurora-ai-ai-image-grid | aurora | Blocks | Free | 1 dep | |
| Aurora AI Attachmentsaurora-ai-attachments | aurora | Blocks | Free | 1 dep | |
| Aurora AI Audio Playeraurora-ai-audio-player | aurora | Blocks | Free | 1 dep | |
| Aurora AI Branchaurora-ai-branch | aurora | Blocks | Free | 1 dep | |
| Aurora AI Canvasaurora-ai-canvas | aurora | Blocks | Free | 1 dep |
