Home / Function/ promptForMinimalConfig() — ui Function Reference

promptForMinimalConfig() — ui Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  deb79baf_3feb_e923_c41b_0555c842f472["promptForMinimalConfig()"]
  f50d8e38_92d7_c930_5ca6_b71673ceb658["init.ts"]
  deb79baf_3feb_e923_c41b_0555c842f472 -->|defined in| f50d8e38_92d7_c930_5ca6_b71673ceb658
  56c01a63_5907_6b2d_a507_d935d5ec6f68["runInit()"]
  56c01a63_5907_6b2d_a507_d935d5ec6f68 -->|calls| deb79baf_3feb_e923_c41b_0555c842f472
  style deb79baf_3feb_e923_c41b_0555c842f472 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/commands/init.ts lines 528–589

async function promptForMinimalConfig(
  defaultConfig: Config,
  opts: z.infer<typeof initOptionsSchema>
) {
  let style = defaultConfig.style
  let baseColor = opts.baseColor
  let cssVariables = defaultConfig.tailwind.cssVariables
  let iconLibrary = defaultConfig.iconLibrary ?? "lucide"

  if (!opts.defaults) {
    const [styles, baseColors, tailwindVersion] = await Promise.all([
      getRegistryStyles(),
      getRegistryBaseColors(),
      getProjectTailwindVersionFromConfig(defaultConfig),
    ])

    const options = await prompts([
      {
        // Skip style prompt if using Tailwind v4 or style is already set in config.
        type: tailwindVersion === "v4" || style ? null : "select",
        name: "style",
        message: `Which ${highlighter.info("style")} would you like to use?`,
        choices: styles.map((style) => ({
          title:
            style.name === "new-york" ? "New York (Recommended)" : style.label,
          value: style.name,
        })),
        initial: 0,
      },
      {
        type: opts.baseColor ? null : "select",
        name: "tailwindBaseColor",
        message: `Which color would you like to use as the ${highlighter.info(
          "base color"
        )}?`,
        choices: baseColors.map((color) => ({
          title: color.label,
          value: color.name,
        })),
      },
    ])

    style = options.style ?? style ?? "new-york"
    baseColor = options.tailwindBaseColor ?? baseColor
    cssVariables = opts.cssVariables
  }

  return rawConfigSchema.parse({
    $schema: defaultConfig?.$schema,
    style,
    tailwind: {
      ...defaultConfig?.tailwind,
      baseColor,
      cssVariables,
    },
    rsc: defaultConfig?.rsc,
    tsx: defaultConfig?.tsx,
    iconLibrary,
    rtl: opts.rtl ?? defaultConfig?.rtl ?? false,
    aliases: defaultConfig?.aliases,
  })
}

Subdomains

Called By

Frequently Asked Questions

What does promptForMinimalConfig() do?
promptForMinimalConfig() is a function in the ui codebase, defined in packages/shadcn/src/commands/init.ts.
Where is promptForMinimalConfig() defined?
promptForMinimalConfig() is defined in packages/shadcn/src/commands/init.ts at line 528.
What calls promptForMinimalConfig()?
promptForMinimalConfig() is called by 1 function(s): runInit.

Analyze Your Own Codebase

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

Try Supermodel Free