[Toolkit][Shadcn] Add radio-group, collapsible, typography and toggle-group recipes - #3464
Conversation
|
Hi, Symfony UX 3.0 has been released, and the Could you please retarget this PR to the Thanks! Status: Needs Work |
998f101 to
b36173a
Compare
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I just changed your base branch, can you also open a PR on https://github.com/symfony/ux.symfony.com, so I can visually see your work? Thanks! |
|
Sorry about this — rebased onto |
There was a problem hiding this comment.
This component does not perform like the Shadcn one, and the example code is wrong too:
Enregistrement.de.l.ecran.2026-04-15.a.19.23.58.mov
Please ensure the behavior is identical, and do not hesitate to write some JS if necessary, thanks 🙏🏻
There was a problem hiding this comment.
Please ensure to re-use the same (and all) examples from https://ui.shadcn.com/docs/components/radix/radio-group#examples 🙏🏻
There was a problem hiding this comment.
Same than Collapsible, but the component must be visually identical than the Shadcn component. Other examples must be added too:
Enregistrement.de.l.ecran.2026-04-15.a.19.31.13.mov
Thanks!
b36173a to
3d53e95
Compare
|
Hey @Kocal! Thanks for the thorough review — I've reworked all four components to match the Shadcn reference as closely as possible. Here's a summary of the changes: Collapsible
Radio Group
Typography
Toggle Group
General
If this looks good to you, I'll continue with my 4 other PRs (currently in draft) for the remaining components and should be able to address any further feedback quickly. 🚀 |
dfe402d to
051113f
Compare
051113f to
debc869
Compare
debc869 to
57f8a1d
Compare
|
Thanks for the contribution @Amoifr! One quick note for your open PRs on Toolkit (and future ones): could you please keep it to one PR per recipe? I review PRs manually, and honestly it wasn't very fun to go through such a large batch of files and changes all at once. Also, please make sure to manually double-check that the visual rendering and the UX match what's provided by the original shadcn/ui components. Thanks! |
This PR was merged into the main branch. Discussion ---------- [Toolkit][Shadcn] Add docs page for collapsible | Q | A | -------------- | --- | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. --> Companion PR to symfony/ux#3464. Adds the Toolkit/Shadcn docs page for the `collapsible` recipe. Also wires the Stimulus `Collapsible` controller in `assets/toolkit-shadcn.js` and `importmap.php` so the interactive demo on the docs page actually works (addition originally contributed by `@Kocal` on the previous #54). Split out from the original #54 so each component can be reviewed/merged independently alongside its upstream recipe. Commits ------- 2dee4b6 [Toolkit][Shadcn] Add docs page for collapsible
This PR was merged into the main branch. Discussion ---------- [Toolkit][Shadcn] Add docs page for radio-group | Q | A | -------------- | --- | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. --> Companion PR to symfony/ux#3464. Adds the Toolkit/Shadcn docs page for the `radio-group` recipe. Split out from the original #54 so each component can be reviewed/merged independently alongside its upstream recipe. Commits ------- c83f0dd [Toolkit][Shadcn] Add docs page for radio-group
This PR was merged into the main branch. Discussion ---------- [Toolkit][Shadcn] Add docs page for toggle-group | Q | A | -------------- | --- | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. --> Companion PR to symfony/ux#3464. Adds the Toolkit/Shadcn docs page for the `toggle-group` recipe. Split out from the original #54 so each component can be reviewed/merged independently alongside its upstream recipe. Commits ------- 4291b1b [Toolkit][Shadcn] Add docs page for toggle-group
This PR was merged into the main branch. Discussion ---------- [Toolkit][Shadcn] Add docs page for typography | Q | A | -------------- | --- | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. --> Companion PR to symfony/ux#3464. Adds the Toolkit/Shadcn docs page for the `typography` recipe. Split out from the original #54 so each component can be reviewed/merged independently alongside its upstream recipe. Commits ------- fad07ab [Toolkit][Shadcn] Add docs page for typography
…mples with shadcn reference (Amoifr) This PR was squashed before being merged into the 3.x branch. Discussion ---------- [Toolkit][Shadcn] Align collapsible File Tree and RTL examples with shadcn reference | Q | A | -------------- | --- | Bug fix? | yes | New feature? | no | Deprecations? | no | Documentation? | no | Issues | Part of #3233 | License | MIT Aligns the `collapsible` examples with the shadcn reference: - **File Tree** (`apps/v4/examples/radix/collapsible-file-tree.tsx`): - Adds a nested `ui/` folder inside `components/` with 6 files (button, card, dialog, input, select, table) - Adds `login-form.tsx`, `register-form.tsx` as siblings of `ui/` in `components/` - Enriches `lib/` with `cn.ts`, `api.ts` - Replaces `use-toast.ts` with `use-media-query.ts`, `use-debounce.ts`, `use-local-storage.ts` in `hooks/` - Adds `api.d.ts` to `types/` - Adds `logo.svg`, `images` to `public/` - **RTL** (`apps/v4/examples/radix/collapsible-rtl.tsx`): - Shadcn uses a shared `language-selector` component (React state + `<Select>`) to swap between English / Arabic / Hebrew. We don't have an equivalent in the Twig toolkit, so instead the example now stacks three independent `Collapsible`s — one per language with its own `dir` — which shows the same intent (RTL + LTR side-by-side) without introducing new JS infrastructure. Follow-up to #3464. Snapshots regenerated. Commits ------- 6258c70 [Toolkit][Shadcn] Align collapsible File Tree and RTL examples with shadcn reference
…ypography recipe (Amoifr) This PR was merged into the 3.x branch. Discussion ---------- [Toolkit][Shadcn] Add Arabic and Hebrew RTL examples to typography recipe | Q | A | -------------- | --- | Bug fix? | yes | New feature? | no | Deprecations? | no | Documentation? | no | Issues | Part of #3233 | License | MIT Adds RTL examples to the `typography` recipe, aligning with the shadcn reference (`apps/v4/examples/radix/typography-rtl.tsx`): - `Arabic.html.twig` — Arabic version of the existing Demo - `Hebrew.html.twig` — Hebrew version of the existing Demo Both wrap the content in `dir="rtl"` and use logical Tailwind utilities (`border-s-2`, `ps-6`, `text-start`) so the layout flips correctly. Shadcn's upstream handles all three languages (en/ar/he) via a shared `language-selector` React component with `useState` + `<Select>`. Since the Twig toolkit has no equivalent, the example is split into two files instead (the English version is already shipped as `Demo.html.twig`). Follow-up to #3464. Snapshots regenerated. Commits ------- 3a5c3bf [Toolkit][Shadcn] Add Arabic and Hebrew RTL examples to typography recipe
… reference (Amoifr) This PR was merged into the 3.x branch. Discussion ---------- [Toolkit][Shadcn] Align toggle-group examples with shadcn reference | Q | A | -------------- | --- | Bug fix? | yes | New feature? | no | Deprecations? | no | Documentation? | no | Issues | Part of #3233 | License | MIT Aligns the `toggle-group` examples with the shadcn reference: - **Sizes** (`apps/v4/examples/radix/toggle-group-sizes.tsx`) — both groups now use `type="single"` (shadcn uses single, ours defaulted to multiple so all items could be pressed at once). - **Spacing** (`apps/v4/examples/radix/toggle-group-spacing.tsx`) — same fix: `type="single"`. - **RTL** (`apps/v4/examples/radix/toggle-group-rtl.tsx`) — adds the Hebrew version stacked below the Arabic one. Shadcn's reference switches languages via the shared `language-selector` component (React state + `<Select>`); the Twig toolkit has no equivalent, so the example stacks both variants like the `collapsible` RTL example does. Follow-up to #3464. Snapshots regenerated. Commits ------- 244967d [Toolkit][Shadcn] Align toggle-group examples with shadcn reference
… (Kocal) This PR was squashed before being merged into the 3.x branch. Discussion ---------- [Toolkit] Add skill for Toolkit recipe development/review | Q | A | -------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Documentation? | no <!-- required for new features, or documentation updates --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT cc `@Amoifr` `@DcgRG` `@zairigimad` `@ker0x` `@seb`-jean `@CODEheures` since you have _recently_ contributed on UX Toolkit. I didn't have the change to try it yet, and I don't know if you all use LLMs, but any suggestion welcome :) Generated with the following prompt (and [caveman](https://github.com/JuliusBrussee/caveman/)): ``` Génère un skill pour UX Toolkit, basé sur : - le code des Kits existants `@src`/Toolkit/kits/ - le `@src`/Toolkit/CONTRIBUTING.md - les commentaires de reviews dans les PR : - #3464 - #3488 - #3490 - #3485 Il aura pour but de faciliter et normaliser la génération de code, et faciliter la code review. Identifie les différents patterns (twig doc, variable `<component>_trigger_attrs` pour Trigger/Close.html.twig, etc...) ``` Thanks! Commits ------- c4e04e1 [Toolkit] Add skill for Toolkit recipe development/review

Hi 👋
This PR adds four recipes from the unchecked list in #3233:
<input type=radio>+accent-primary), with aRadioGroup:Itemsub-component.<details>/<summary>based, no JS.variant/sizepropagated to items through outer-context variables (_toggle_group_variant/_toggle_group_size).Each recipe has a
Usage.html.twigand aDemo.html.twigexample and passing snapshot tests.I initially planned to send these as separate PRs and asked for a sanity check on #3233 — happy to split them back up if that is easier to review. Each recipe is a single commit so rebasing into 4 PRs is straightforward.
Note on sub-component context propagation
While working on
radio-group, I noticed that variables set in a parent component ({% set _radio_group_name = ... %}) do not propagate to self-closing children, because<twig:RadioGroup:Item .../>compiles to acomponent()function call that does not carry outer context. It works fine for non-self-closing children (e.g.<twig:ToggleGroup:Item>...</twig:ToggleGroup:Item>, which uses the{% component %}tag — this pattern is used intoggle-groupto inheritvariant/size).For
radio-group,Itemis always self-closing, so I keptnameas an explicit prop on eachItem. Curious if you would prefer a different pattern here (e.g.outerScope, forcing a block body, a helper).Thanks a lot for the Toolkit work! 🙏