Home / Function/ promptForConfig() — ui Function Reference

promptForConfig() — ui Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/shadcn/src/commands/init.ts lines 412–526

async function promptForConfig(defaultConfig: Config | null = null) {
  const [styles, baseColors] = await Promise.all([
    getRegistryStyles(),
    getRegistryBaseColors(),
  ])

  logger.info("")
  const options = await prompts([
    {
      type: "toggle",
      name: "typescript",
      message: `Would you like to use ${highlighter.info(
        "TypeScript"
      )} (recommended)?`,
      initial: defaultConfig?.tsx ?? true,
      active: "yes",
      inactive: "no",
    },
    {
      type: "select",
      name: "style",
      message: `Which ${highlighter.info("style")} would you like to use?`,
      choices: styles.map((style) => ({
        title: style.label,
        value: style.name,
      })),
    },
    {
      type: "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,
      })),
    },
    {
      type: "text",
      name: "tailwindCss",
      message: `Where is your ${highlighter.info("global CSS")} file?`,
      initial: defaultConfig?.tailwind.css ?? DEFAULT_TAILWIND_CSS,
    },
    {
      type: "toggle",
      name: "tailwindCssVariables",
      message: `Would you like to use ${highlighter.info(
        "CSS variables"
      )} for theming?`,
      initial: defaultConfig?.tailwind.cssVariables ?? true,
      active: "yes",
      inactive: "no",
    },
    {
      type: "text",
      name: "tailwindPrefix",
      message: `Are you using a custom ${highlighter.info(
        "tailwind prefix eg. tw-"
      )}? (Leave blank if not)`,
      initial: "",
    },
    {
      type: "text",
      name: "tailwindConfig",
      message: `Where is your ${highlighter.info(
        "tailwind.config.js"
      )} located?`,
      initial: defaultConfig?.tailwind.config ?? DEFAULT_TAILWIND_CONFIG,
    },
    {
      type: "text",
      name: "components",
      message: `Configure the import alias for ${highlighter.info(
        "components"
      )}:`,
      initial: defaultConfig?.aliases["components"] ?? DEFAULT_COMPONENTS,
    },
    {
      type: "text",
      name: "utils",

Subdomains

Called By

Frequently Asked Questions

What does promptForConfig() do?
promptForConfig() is a function in the ui codebase, defined in packages/shadcn/src/commands/init.ts.
Where is promptForConfig() defined?
promptForConfig() is defined in packages/shadcn/src/commands/init.ts at line 412.
What calls promptForConfig()?
promptForConfig() 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