formatItemExamples() — ui Function Reference
Architecture documentation for the formatItemExamples() function in utils.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 564a22d8_005d_36c3_394c_4afa6fbaf2ee["formatItemExamples()"] 7f4634ea_efbc_d613_10b1_f8b135d63ff3["utils.ts"] 564a22d8_005d_36c3_394c_4afa6fbaf2ee -->|defined in| 7f4634ea_efbc_d613_10b1_f8b135d63ff3 style 564a22d8_005d_36c3_394c_4afa6fbaf2ee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/mcp/utils.ts lines 103–132
export function formatItemExamples(
items: z.infer<typeof registryItemSchema>[],
query: string
) {
const sections = items.map((item) => {
const parts: string[] = [
`## Example: ${item.name}`,
item.description ? `\n${item.description}\n` : "",
]
if (item.files?.length) {
item.files.forEach((file) => {
if (file.content) {
parts.push(`### Code (${file.path}):\n`)
parts.push("```tsx")
parts.push(file.content)
parts.push("```")
}
})
}
return parts.filter(Boolean).join("\n")
})
const header = `# Usage Examples\n\nFound ${items.length} example${
items.length > 1 ? "s" : ""
} matching "${query}":\n`
return header + sections.join("\n\n---\n\n")
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does formatItemExamples() do?
formatItemExamples() is a function in the ui codebase, defined in packages/shadcn/src/mcp/utils.ts.
Where is formatItemExamples() defined?
formatItemExamples() is defined in packages/shadcn/src/mcp/utils.ts at line 103.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free