Home / Function/ generateStaticParams() — ui Function Reference

generateStaticParams() — ui Function Reference

Architecture documentation for the generateStaticParams() function in page.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  5c02f67c_5880_1088_8265_ac7c2c50b635["generateStaticParams()"]
  56e49ac2_e6e7_ad0b_a9c0_eda10335ae82["page.tsx"]
  5c02f67c_5880_1088_8265_ac7c2c50b635 -->|defined in| 56e49ac2_e6e7_ad0b_a9c0_eda10335ae82
  style 5c02f67c_5880_1088_8265_ac7c2c50b635 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/app/(view)/view/[style]/[name]/page.tsx lines 85–159

export async function generateStaticParams() {
  const { Index } = await import("@/registry/__index__")
  // const { Index: BasesIndex } = await import("@/registry/bases/__index__")
  const { ExamplesIndex } = await import("@/examples/__index__")
  const params: Array<{ style: string; name: string }> = []

  for (const style of legacyStyles) {
    // Check if this is a base-prefixed style (e.g., base-nova, radix-nova).
    const baseMatch = style.name.match(/^(base|radix)-/)
    if (baseMatch) {
      const baseName = baseMatch[1]

      // Add examples from ExamplesIndex.
      const examples = ExamplesIndex[baseName]
      if (examples) {
        for (const exampleName of Object.keys(examples)) {
          if (exampleName.startsWith("sidebar-")) {
            params.push({
              style: style.name,
              name: exampleName,
            })
          }
        }
      }

      // // Add UI components from BasesIndex.
      // const baseIndex = BasesIndex[baseName]
      // if (baseIndex) {
      //   for (const itemName in baseIndex) {
      //     const item = baseIndex[itemName]
      //     if (
      //       [
      //         "registry:block",
      //         "registry:component",
      //         "registry:example",
      //         "registry:internal",
      //       ].includes(item.type)
      //     ) {
      //       params.push({
      //         style: style.name,
      //         name: item.name,
      //       })
      //     }
      //   }
      // }

      continue
    }

    // Handle legacy styles (e.g., new-york-v4).
    if (!Index[style.name]) {
      continue
    }

    const styleIndex = Index[style.name]
    for (const itemName in styleIndex) {
      const item = styleIndex[itemName]
      if (
        [
          "registry:block",
          "registry:component",
          "registry:example",
          "registry:internal",
        ].includes(item.type)
      ) {
        params.push({
          style: style.name,
          name: item.name,
        })
      }
    }
  }

  return params
}

Subdomains

Frequently Asked Questions

What does generateStaticParams() do?
generateStaticParams() is a function in the ui codebase, defined in apps/v4/app/(view)/view/[style]/[name]/page.tsx.
Where is generateStaticParams() defined?
generateStaticParams() is defined in apps/v4/app/(view)/view/[style]/[name]/page.tsx at line 85.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free