Home / Function/ add() — ui Function Reference

add() — ui Function Reference

Architecture documentation for the add() function in add.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  6f22aa38_1a2d_7f59_ac01_05f3961c54bd["add()"]
  670848eb_ec36_f11f_b3df_91f7406ddb11["add.ts"]
  6f22aa38_1a2d_7f59_ac01_05f3961c54bd -->|defined in| 670848eb_ec36_f11f_b3df_91f7406ddb11
  fab87808_64e1_7446_6549_1011808ed85b["promptForRegistries()"]
  6f22aa38_1a2d_7f59_ac01_05f3961c54bd -->|calls| fab87808_64e1_7446_6549_1011808ed85b
  558f5848_ce45_aac3_5ed4_c4d67da29963["addRegistriesToConfig()"]
  6f22aa38_1a2d_7f59_ac01_05f3961c54bd -->|calls| 558f5848_ce45_aac3_5ed4_c4d67da29963
  style 6f22aa38_1a2d_7f59_ac01_05f3961c54bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/commands/registry/add.ts lines 31–50

  .action(async (registries: string[], opts) => {
    try {
      const options = addOptionsSchema.parse({
        cwd: path.resolve(opts.cwd),
        silent: opts.silent,
      })

      const registryArgs =
        registries.length > 0
          ? registries
          : await promptForRegistries({ silent: options.silent })

      await addRegistriesToConfig(registryArgs, options.cwd, {
        silent: options.silent,
      })
    } catch (error) {
      logger.break()
      handleError(error)
    }
  })

Subdomains

Frequently Asked Questions

What does add() do?
add() is a function in the ui codebase, defined in packages/shadcn/src/commands/registry/add.ts.
Where is add() defined?
add() is defined in packages/shadcn/src/commands/registry/add.ts at line 31.
What does add() call?
add() calls 2 function(s): addRegistriesToConfig, promptForRegistries.

Analyze Your Own Codebase

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

Try Supermodel Free