Claude Skill

ux-toolkit

Symfony UX Toolkit: install editable Twig buttons, dialogs and forms from Shadcn UI, Flowbite or Bootstrap kits. Use for ux:install, --kit, recipe dependencies, CSS setup, copied TwigComponents and Stimulus controllers, ux_toolkit configuration and custom kits.

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download smnandre-symfony-ux-skills-skills_ux-toolkit-78c25ed.zip · 7 KB

Install

skills CLI npx skills add https://github.com/smnandre/symfony-ux-skills/tree/main/skills/ux-toolkit
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install smnandre-symfony-ux-skills@llmmart
Git git clone https://github.com/smnandre/symfony-ux-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole smnandre/symfony-ux-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

UX Toolkit

Install UI components the way Shadcn UI does: ux:install copies a recipe's Twig components and Stimulus controllers into your project, and from then on the code is yours to edit. Nothing stays in vendor/: the code, and its updates, are yours.

Since Symfony UX 3.7+, the Toolkit follows the Symfony BC promise for the ux:install arguments and options, the ux_toolkit configuration and the manifest format. Recipe content itself can change between versions.

Installation

composer require --dev symfony/ux-toolkit

The package only registers console commands: rendering never needs it, only installing recipes does. The installed components rely on TwigComponent and, for the interactive ones, on StimulusBundle.

Quick Reference

php bin/console ux:install                          Pick a kit, then a recipe, interactively
php bin/console ux:install button --kit=shadcn      Install one recipe from one kit
php bin/console ux:install dialog -k shadcn -f      Overwrite changed files without asking
--kit=github.com/acme/ui-kit:v1.2                   A community kit from a GitHub repository root
Kit (--kit) Styling Recipes
shadcn Tailwind CSS 4, Shadcn UI "Nova" 64 components, 26 blocks (login, signup, sidebar)
flowbite-4 Tailwind CSS 4, Flowbite v4 22 components
bootstrap Bootstrap 5.3 25 components
common Unstyled helpers 7 components (clipboard, post-link, logout-link...)

Full recipe lists and the CSS setup of each kit: references/kits.md.

Installing a Recipe

php bin/console ux:install dialog --kit=shadcn
  1. The recipe and its recipe dependencies are copied (dialog also installs button): Twig files to templates/components/, controllers to assets/controllers/.
  2. An identical existing file is skipped. A changed file prompts for overwrite, after a git diff when git is available; --force overwrites.
  3. A "Next steps" section lists the packages to install. The command installs none of them: run the printed composer require ... and importmap:require ... (or npm install ...) yourself. It always lists the kit's global packages, even when they are already installed.

Run it from the project root: files go to --destination, which defaults to the current directory. In a non-interactive shell, pass both the recipe and --kit, and add --force to replace changed files (they are skipped otherwise).

Kit Setup (once per project)

Each kit needs its CSS foundation before the first recipe looks right. For Shadcn UI with AssetMapper and the TailwindBundle:

php bin/console importmap:require shadcn/dist/tailwind.css tw-animate-css/dist/tw-animate.css
composer require twig/extra-bundle twig/html-extra tales-from-a-dev/twig-tailwind-extra symfony/ux-icons
/* assets/styles/app.css */
@import 'tailwindcss';
@import '../vendor/tw-animate-css/dist/tw-animate.css';
@import '../vendor/shadcn/dist/tailwind.css';

@custom-variant dark (&:is(.dark *));

/* + the @theme inline mapping, the :root and .dark color variables,
   and the @layer base rules from the kit's INSTALL.md */

Copy the theme block from kits/shadcn/INSTALL.md or the Shadcn UI kit page. The block defines the tokens used by the recipes, including --background, --primary and --radius. For the other kits, see the Flowbite and Bootstrap setup.

Using the Components

Recipes are anonymous TwigComponents with props declared in {% props %} and variants built with html_cva:

<twig:Button>Save</twig:Button>
<twig:Button variant="outline" size="sm">Cancel</twig:Button>
<twig:Button as="a" href="{{ path('app_home') }}" variant="link">Home</twig:Button>
<twig:Button variant="ghost" size="icon" aria-label="Delete">
    <twig:ux:icon name="lucide:trash-2" />
</twig:Button>

Classes you pass merge with the variant classes through tailwind_classes, and yours win on conflict (class="rounded-full" replaces the default radius).

Compound components share state with provide() / inject(). Triggers expose an attribute set to spread on your own element:

<twig:Dialog id="delete_account">
    <twig:Dialog:Trigger>
        <twig:Button variant="destructive" {{ ...dialog_trigger_attrs }}>Delete account</twig:Button>
    </twig:Dialog:Trigger>
    <twig:Dialog:Content>
        <twig:Dialog:Header>
            <twig:Dialog:Title>Are you absolutely sure?</twig:Dialog:Title>
            <twig:Dialog:Description>This cannot be undone.</twig:Dialog:Description>
        </twig:Dialog:Header>
        <twig:Dialog:Footer>
            <twig:Dialog:Close>
                <twig:Button variant="outline" {{ ...dialog_close_attrs }}>Cancel</twig:Button>
            </twig:Dialog:Close>
        </twig:Dialog:Footer>
    </twig:Dialog:Content>
</twig:Dialog>

The same pattern gives alert_dialog_trigger_attrs, tooltip_trigger_attrs and modal_trigger_attrs (Flowbite). Each recipe's README, and its page on ux.symfony.com, lists the props and examples.

Configuration

Since Symfony UX 3.7+, choose where files go, and optionally namespace them:

# config/packages/ux_toolkit.yaml
when@dev:
    ux_toolkit:
        components:
            dir: 'templates/components'   # TwigComponent anonymous template directory
            subdirectory: 'ui'            # components become <twig:ui:Button>
        controllers:
            dir: 'assets/controllers'     # must match your Stimulus controller path
            subdirectory: 'ui'            # identifiers become ui--dialog

The installer rewrites component names and Stimulus identifiers in the copied files to match. Both dir values must match your Twig, TwigComponent and Stimulus configuration, so that the installed files get loaded. Keep the file under when@dev when the bundle is only enabled in dev.

Custom Kits

A kit is a folder (or a GitHub repository root) with a manifest.json and one folder per recipe. Install from GitHub with --kit=github.com/acme/ui-kit (:ref for a tag or branch; main by default; needs symfony/http-client and ext-zip).

vendor/bin/ux-toolkit-kit-create    # scaffold manifest.json and a Button recipe
vendor/bin/ux-toolkit-kit-lint      # validate the kit (--fail-on-warning for CI)
vendor/bin/ux-toolkit-kit-debug     # list each recipe's files and dependencies

Manifest keys, placeholders and naming rules: references/kits.md.

Gotchas

  • The recipe name you install is its folder name (login-01, logout-link); the manifest name ("LoginForm") is only a label.
  • Re-running ux:install is the only upgrade path: read the diff for each changed file, since your edits live in the same files.
  • Shadcn recipes use lucide: icons through UX Icons: install symfony/ux-icons and lock icons before deploying (see ux-icons).
  • Interactive recipes import @hotwired/stimulus: although no recipe lists it, StimulusBundle must be set up.
  • On Tailwind 4, buttons default to cursor: default: add button:not(:disabled) { cursor: pointer; } to your base layer if you want the pointer.

References

See Also

  • twig-component: props, blocks, attributes, html_cva, provide() / inject() behind every recipe
  • stimulus: the controllers recipes install
  • ux-icons: icons used by the Shadcn UI and Flowbite recipes
Files (symfony-ux-skills)
  • references
    • kits.md 9.2 KB
      Loading…
  • SKILL.md 8.6 KB
    ---
    name: ux-toolkit
    description: 'Symfony UX Toolkit: install editable Twig buttons, dialogs and forms from Shadcn UI, Flowbite or Bootstrap kits. Use for ux:install, --kit, recipe dependencies, CSS setup, copied TwigComponents and Stimulus controllers, ux_toolkit configuration and custom kits.'
    license: MIT
    metadata:
      author: Simon André
      url: https://smnandre.dev
    ---
    
    # UX Toolkit
    
    Install UI components the way Shadcn UI does: `ux:install` copies a recipe's Twig components and Stimulus controllers into your project, and from then on the code is yours to edit. Nothing stays in `vendor/`: the code, and its updates, are yours.
    
    Since Symfony UX 3.7+, the Toolkit follows the Symfony BC promise for the `ux:install` arguments and options, the `ux_toolkit` configuration and the manifest format. Recipe content itself can change between versions.
    
    ## Installation
    
    ```bash
    composer require --dev symfony/ux-toolkit
    ```
    
    The package only registers console commands: rendering never needs it, only installing recipes does. The installed components rely on TwigComponent and, for the interactive ones, on StimulusBundle.
    
    ## Quick Reference
    
    ```
    php bin/console ux:install                          Pick a kit, then a recipe, interactively
    php bin/console ux:install button --kit=shadcn      Install one recipe from one kit
    php bin/console ux:install dialog -k shadcn -f      Overwrite changed files without asking
    --kit=github.com/acme/ui-kit:v1.2                   A community kit from a GitHub repository root
    ```
    
    | Kit (`--kit`) | Styling | Recipes |
    |---------------|---------|---------|
    | `shadcn` | Tailwind CSS 4, Shadcn UI "Nova" | 64 components, 26 blocks (login, signup, sidebar) |
    | `flowbite-4` | Tailwind CSS 4, Flowbite v4 | 22 components |
    | `bootstrap` | Bootstrap 5.3 | 25 components |
    | `common` | Unstyled helpers | 7 components (clipboard, post-link, logout-link...) |
    
    Full recipe lists and the CSS setup of each kit: [references/kits.md](references/kits.md).
    
    ## Installing a Recipe
    
    ```bash
    php bin/console ux:install dialog --kit=shadcn
    ```
    
    1. The recipe and its recipe dependencies are copied (`dialog` also installs `button`): Twig files to `templates/components/`, controllers to `assets/controllers/`.
    2. An identical existing file is skipped. A changed file prompts for overwrite, after a `git diff` when git is available; `--force` overwrites.
    3. A "Next steps" section lists the packages to install. **The command installs none of them**: run the printed `composer require ...` and `importmap:require ...` (or `npm install ...`) yourself. It always lists the kit's global packages, even when they are already installed.
    
    Run it from the project root: files go to `--destination`, which defaults to the current directory. In a non-interactive shell, pass both the recipe and `--kit`, and add `--force` to replace changed files (they are skipped otherwise).
    
    ## Kit Setup (once per project)
    
    Each kit needs its CSS foundation before the first recipe looks right. For Shadcn UI with AssetMapper and the TailwindBundle:
    
    ```bash
    php bin/console importmap:require shadcn/dist/tailwind.css tw-animate-css/dist/tw-animate.css
    composer require twig/extra-bundle twig/html-extra tales-from-a-dev/twig-tailwind-extra symfony/ux-icons
    ```
    
    ```css
    /* assets/styles/app.css */
    @import 'tailwindcss';
    @import '../vendor/tw-animate-css/dist/tw-animate.css';
    @import '../vendor/shadcn/dist/tailwind.css';
    
    @custom-variant dark (&:is(.dark *));
    
    /* + the @theme inline mapping, the :root and .dark color variables,
       and the @layer base rules from the kit's INSTALL.md */
    ```
    
    Copy the theme block from `kits/shadcn/INSTALL.md` or the [Shadcn UI kit page](https://ux.symfony.com/toolkit/kits/shadcn). The block defines the tokens used by the recipes, including `--background`, `--primary` and `--radius`. For the other kits, see the [Flowbite and Bootstrap setup](references/kits.md).
    
    ## Using the Components
    
    Recipes are anonymous TwigComponents with props declared in `{% props %}` and variants built with `html_cva`:
    
    ```twig
    <twig:Button>Save</twig:Button>
    <twig:Button variant="outline" size="sm">Cancel</twig:Button>
    <twig:Button as="a" href="{{ path('app_home') }}" variant="link">Home</twig:Button>
    <twig:Button variant="ghost" size="icon" aria-label="Delete">
        <twig:ux:icon name="lucide:trash-2" />
    </twig:Button>
    ```
    
    Classes you pass merge with the variant classes through `tailwind_classes`, and yours win on conflict (`class="rounded-full"` replaces the default radius).
    
    Compound components share state with `provide()` / `inject()`. Triggers expose an attribute set to spread on your own element:
    
    ```twig
    <twig:Dialog id="delete_account">
        <twig:Dialog:Trigger>
            <twig:Button variant="destructive" {{ ...dialog_trigger_attrs }}>Delete account</twig:Button>
        </twig:Dialog:Trigger>
        <twig:Dialog:Content>
            <twig:Dialog:Header>
                <twig:Dialog:Title>Are you absolutely sure?</twig:Dialog:Title>
                <twig:Dialog:Description>This cannot be undone.</twig:Dialog:Description>
            </twig:Dialog:Header>
            <twig:Dialog:Footer>
                <twig:Dialog:Close>
                    <twig:Button variant="outline" {{ ...dialog_close_attrs }}>Cancel</twig:Button>
                </twig:Dialog:Close>
            </twig:Dialog:Footer>
        </twig:Dialog:Content>
    </twig:Dialog>
    ```
    
    The same pattern gives `alert_dialog_trigger_attrs`, `tooltip_trigger_attrs` and `modal_trigger_attrs` (Flowbite). Each recipe's README, and its page on ux.symfony.com, lists the props and examples.
    
    ## Configuration
    
    Since Symfony UX 3.7+, choose where files go, and optionally namespace them:
    
    ```yaml
    # config/packages/ux_toolkit.yaml
    when@dev:
        ux_toolkit:
            components:
                dir: 'templates/components'   # TwigComponent anonymous template directory
                subdirectory: 'ui'            # components become <twig:ui:Button>
            controllers:
                dir: 'assets/controllers'     # must match your Stimulus controller path
                subdirectory: 'ui'            # identifiers become ui--dialog
    ```
    
    The installer rewrites component names and Stimulus identifiers in the copied files to match. Both `dir` values must match your Twig, TwigComponent and Stimulus configuration, so that the installed files get loaded. Keep the file under `when@dev` when the bundle is only enabled in dev.
    
    ## Custom Kits
    
    A kit is a folder (or a GitHub repository root) with a `manifest.json` and one folder per recipe. Install from GitHub with `--kit=github.com/acme/ui-kit` (`:ref` for a tag or branch; `main` by default; needs `symfony/http-client` and `ext-zip`).
    
    ```bash
    vendor/bin/ux-toolkit-kit-create    # scaffold manifest.json and a Button recipe
    vendor/bin/ux-toolkit-kit-lint      # validate the kit (--fail-on-warning for CI)
    vendor/bin/ux-toolkit-kit-debug     # list each recipe's files and dependencies
    ```
    
    Manifest keys, placeholders and naming rules: [references/kits.md](references/kits.md#custom-kits).
    
    ## Gotchas
    
    - The recipe name you install is its **folder name** (`login-01`, `logout-link`); the manifest `name` ("LoginForm") is only a label.
    - Re-running `ux:install` is the only upgrade path: read the diff for each changed file, since your edits live in the same files.
    - Shadcn recipes use `lucide:` icons through UX Icons: install `symfony/ux-icons` and lock icons before deploying (see ux-icons).
    - Interactive recipes import `@hotwired/stimulus`: although no recipe lists it, StimulusBundle must be set up.
    - On Tailwind 4, buttons default to `cursor: default`: add `button:not(:disabled) { cursor: pointer; }` to your base layer if you want the pointer.
    
    ## References
    
    - [Symfony UX package page](https://ux.symfony.com/toolkit) ([Markdown summary](https://ux.symfony.com/toolkit.md)) · [`symfony/ux-toolkit` on Packagist](https://packagist.org/packages/symfony/ux-toolkit).
    - Try the [Toolkit component demo](https://ux.symfony.com/toolkit#demo).
    - The [UI kit catalog](https://ux.symfony.com/kits) links to the recipe previews for [Bootstrap](https://ux.symfony.com/toolkit/kits/bootstrap), [Common](https://ux.symfony.com/toolkit/kits/common), [daisyUI](https://ux.symfony.com/toolkit/kits/daisyui-5), [Flowbite](https://ux.symfony.com/toolkit/kits/flowbite-4) and [Shadcn UI](https://ux.symfony.com/toolkit/kits/shadcn).
    - For installing recipes, choosing kits and configuring target paths, see the [Symfony UX Toolkit documentation](https://symfony.com/bundles/ux-toolkit).
    - **Kits** (recipe lists, per-kit CSS setup, helper packages, manifest format, custom kits): [references/kits.md](references/kits.md)
    
    ## See Also
    
    - **twig-component**: props, blocks, `attributes`, `html_cva`, `provide()` / `inject()` behind every recipe
    - **stimulus**: the controllers recipes install
    - **ux-icons**: icons used by the Shadcn UI and Flowbite recipes
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.