getAllBlocks() — ui Function Reference
Architecture documentation for the getAllBlocks() function in blocks.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 3bdd95c1_b977_a6c0_8d7f_89d3386ab1c1["getAllBlocks()"] 79002c8a_43c0_28c4_2b18_096fa400899d["blocks.ts"] 3bdd95c1_b977_a6c0_8d7f_89d3386ab1c1 -->|defined in| 79002c8a_43c0_28c4_2b18_096fa400899d 87aaf320_3f44_6ded_49f3_79833fbc4422["getAllBlockIds()"] 87aaf320_3f44_6ded_49f3_79833fbc4422 -->|calls| 3bdd95c1_b977_a6c0_8d7f_89d3386ab1c1 style 3bdd95c1_b977_a6c0_8d7f_89d3386ab1c1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/lib/blocks.ts lines 18–57
export async function getAllBlocks(
types: z.infer<typeof registryItemSchema>["type"][] = [
"registry:block",
"registry:internal",
],
categories: string[] = []
) {
const { Index } = await import("@/registry/__index__")
// Collect all blocks from all styles.
const allBlocks: z.infer<typeof registryItemSchema>[] = []
for (const style in Index) {
const styleIndex = Index[style]
if (typeof styleIndex === "object" && styleIndex !== null) {
for (const itemName in styleIndex) {
const item = styleIndex[itemName]
allBlocks.push(item)
}
}
}
// Validate each block.
const validatedBlocks = allBlocks
.map((block) => {
const result = registryItemSchema.safeParse(block)
return result.success ? result.data : null
})
.filter(
(block): block is z.infer<typeof registryItemSchema> => block !== null
)
return validatedBlocks.filter(
(block) =>
types.includes(block.type) &&
(categories.length === 0 ||
block.categories?.some((category) => categories.includes(category))) &&
!block.name.startsWith("chart-")
)
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getAllBlocks() do?
getAllBlocks() is a function in the ui codebase, defined in apps/v4/lib/blocks.ts.
Where is getAllBlocks() defined?
getAllBlocks() is defined in apps/v4/lib/blocks.ts at line 18.
What calls getAllBlocks()?
getAllBlocks() is called by 1 function(s): getAllBlockIds.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free