Skip to content

Setting Up the UI Kit Generator

What you'll learn

  • Adding ui-kit and theme-variant commands to your monorepo toolkit
  • Scaffolding components from the CLI without manual prompts
  • Batch-generating multiple components
  • Managing theme variants from the command line

Prerequisites

Step 1: Generate the UI Kit Generator

bash
archipelago generate ui_kit_generator

You will be prompted for:

  • appNameMyApp (must match your monorepo app name)
  • isForMonorepotrue

Or use a config file:

json
{
  "appName": "MyApp",
  "isForMonorepo": true
}
bash
archipelago generate ui_kit_generator --config uikit_gen_config.json

Step 2: Understand the Generated Structure

The generator adds commands to your existing monorepo toolkit:

devtools/
├── monorepo_toolkit/
│   └── lib/src/commands/
│       ├── ui_kit_command.dart          # Scaffold components
│       └── theme_variant_command.dart   # Generate theme variants
└── scripts/
    └── ui_kit_generator/
        ├── lib/src/
        │   ├── component_scaffolder.dart  # Component generation logic
        │   └── theme_scaffolder.dart      # Theme generation logic
        └── pubspec.yaml

Step 3: Scaffold a Component via CLI

Instead of running archipelago generate ui_kit_component with interactive prompts, use the toolkit command:

bash
monorepo_toolkit ui-kit create button \
  --atomic-type atom \
  --widget-type stateful \
  --prefix App \
  --variants \
  --sizes \
  --types

This is equivalent to generating a component brick but faster for batch workflows.

Step 4: Generate a Theme Variant

bash
monorepo_toolkit theme-variant create high_contrast \
  --prefix App \
  --base-theme light \
  --color-overrides \
  --typography-overrides

Step 5: Batch Scaffolding

Create a manifest file for generating multiple components at once:

yaml
# ui_components.yaml
components:
  - name: button
    atomic_type: atom
    widget_type: stateful
    variants: true
    sizes: true
    types: true
  - name: card
    atomic_type: molecule
    widget_type: stateless
    variants: true
    sizes: false
    types: false
  - name: dialog
    atomic_type: molecule
    widget_type: stateful
    variants: false
    sizes: true
    types: false
bash
monorepo_toolkit ui-kit batch --config ui_components.yaml

Common Customizations

CustomizationWhere to Change
Default prefixConfigure in toolkit settings
Component templatesscripts/ui_kit_generator/lib/src/
Custom atomic levelsExtend component_scaffolder.dart
Post-generation hooksAdd barrel export updates

Next Steps

Built by Banua Coder