@@ -7,26 +7,24 @@ to change, or even change drastically.
77Symfony UX Toolkit provides a set of ready-to-use kits for Symfony applications.
88It is part of `the Symfony UX initiative `_.
99
10- Kits are a nice way to begin a new Symfony application, by providing a set
11- of `Twig components `_ (based on Tailwind CSS, but fully customizable depending
12- on your needs).
10+ Kits are a nice way to begin a new Symfony application, they contains
11+ recipes to install nicely-crafter `Twig components `_ (already stylized,
12+ but fully customizable depending on your needs) and more .
1313
1414Please note that the **UX Toolkit is not a library of UI components **,
1515but **a tool to help you build your own UI components **.
1616It uses the same approach than the popular `Shadcn UI `_,
1717and a similar approach than `Tailwind Plus `_.
1818
19- After installing the UX Toolkit, you can start pulling the components you need
20- from `UX Toolkit Kits `_, and use them in your project.
21- They become **your own components **, and **you can customize them as you want **.
19+ After installing the UX Toolkit, you can start installing the recipes you need
20+ from `UX Toolkit Kits `_ and use them in your project.
21+ Files created by the recipes become part of your project, and
22+ you can customize them as you want.
2223
2324Additionally, some `Twig components `_ use ``html_cva `` and ``tailwind_merge ``,
2425you can either remove them from your project or install ``twig/html-extra ``
2526and ``tales-from-a-dev/twig-tailwind-extra `` to use them.
2627
27- Also, we do not force you to use Tailwind CSS at all. You can use whatever
28- CSS framework you want, but you will need to adapt the UI components to it.
29-
3028Installation
3129------------
3230
@@ -37,27 +35,25 @@ Install the UX Toolkit using Composer and Symfony Flex:
3735 # The UX Toolkit is a development dependency:
3836 $ composer require --dev symfony/ux-toolkit
3937
40- # If you want to keep `html_cva` and `tailwind_merge` in your Twig components:
41- $ composer require twig/extra-bundle twig/html-extra:^3.12.0 tales-from-a-dev/twig-tailwind-extra
42-
4338 Usage
4439-----
4540
46- You may find a list of components in the `UX Components page `_ , with the installation instructions for each of them.
41+ You may find a list of available kits in the `UX Toolkit Kits `_ page , with the installation instructions for each of them.
4742
4843For example, if you want to install a `Button ` component, you will find the following instruction:
4944
5045.. code-block :: terminal
5146
5247 $ php bin/console ux:install Button --kit=<kitName>
5348
54- It will create the ``templates/components/Button.html.twig `` file, and you will be able to use the `Button ` component like this:
49+ It will create the ``templates/components/Button.html.twig `` file in your project,
50+ and you will be able to use the `Button ` component like this:
5551
5652.. code-block :: html+twig
5753
5854 <twig:Button>Click me</twig:Button>
5955
60- Create your own kit
56+ Create your own Kit
6157-------------------
6258
6359You have the ability to create and share your own kit with the community,
@@ -96,20 +92,55 @@ After creating your kit, the repository should have the following structure:
9692.. code-block :: text
9793
9894 .
99- ├── docs
100- │ └── components
101- │ └── Button.twig
102- ├── manifest.json
103- └── templates
104- └── components
105- └── Button.html.twig
106-
107- A kit is composed of:
108-
109- - A ``manifest.json `` file, that describes the kit (name, description, dependencies, ...),
110- - A ``templates/components `` directory, that contains the Twig components,
111- - A ``assets `` directory, optional, that contains the assets (CSS, JS, Stimulus Controllers, ...) used by the components,
112- - A ``examples `` directory, optional, that contains Twig code examples
95+ ├── Button
96+ │ ├── manifest.json
97+ │ └── templates
98+ │ └── components
99+ │ └── Button.html.twig
100+ └── manifest.json
101+
102+
103+ A kit is described by a ``manifest.json `` file at the root directory, which contains the metadata of the kit:
104+
105+ .. code-block :: json
106+
107+ {
108+ "$schema" : " ../vendor/symfony/ux-toolkit/schema-kit-v1.json" ,
109+ "name" : " My UX Toolkit Kit" ,
110+ "description" : " A custom kit for Symfony UX Toolkit." ,
111+ "homepage" : " https://github/com/User/MyUxToolkitKit" ,
112+ "license" : " MIT"
113+ }
114+
115+ Then, a kit can contain one or more recipes. Each recipe is a directory
116+ with a ``manifest.json `` file and some files to be copied into the project.
117+
118+ The ``manifest.json `` file of a recipe contains the metadata of the recipe:
119+
120+ .. code-block :: json
121+
122+ {
123+ "$schema" : " ../vendor/symfony/ux-toolkit/schema-kit-recipe-v1.json" ,
124+ "name" : " Button" ,
125+ "description" : " A clickable element that triggers actions or events, supporting various styles and states." ,
126+ "copy-files" : {
127+ "templates/" : " templates/"
128+ },
129+ "dependencies" : {
130+ {
131+ "type" : " php" ,
132+ "package" : " twig/extra-bundle"
133+ },
134+ {
135+ "type" : " php" ,
136+ "package" : " twig/html-extra:^3.12.0"
137+ },
138+ {
139+ "type" : " php" ,
140+ "package" : " tales-from-a-dev/twig-tailwind-extra"
141+ }
142+ }
143+ }
113144
114145 Using your kit
115146~~~~~~~~~~~~~~
0 commit comments