Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
865c825
fix(demo): clear the whole cache when switching the admin UI or theme
camilleislasse Nov 14, 2026
1231aa6
fix(demo): read the dashboard chart colors from the shadcn tokens
camilleislasse Nov 14, 2026
0efca11
fix(demo): port the dashboard, export button and book page to shadcn
camilleislasse Nov 14, 2026
9cdb835
fix(shadcn-admin-ui): escape the copy button classes only once
camilleislasse Nov 14, 2026
e74b23f
docs: add the ShadcnAdminUi version of the cookbook templates
camilleislasse Nov 14, 2026
95f3ccf
docs(shadcn-admin-ui): list only the kit changes that UX Toolkit 3.7 …
camilleislasse Nov 14, 2026
30df904
docs(shadcn-admin-ui): list the removed symfony_ux and added themes h…
camilleislasse Nov 14, 2026
375c0de
refactor(shadcn-admin-ui): render the flash messages with the Alert c…
camilleislasse Nov 14, 2026
bdc120c
docs(shadcn-admin-ui): list every template copying the kit classes
camilleislasse Nov 14, 2026
3f13158
refactor(shadcn-admin-ui): render the form error alert with the Alert…
camilleislasse Nov 14, 2026
36474c4
refactor(shadcn-admin-ui): render the login error with the Alert comp…
camilleislasse Nov 14, 2026
f7066af
refactor(shadcn-admin-ui): render the breadcrumbs with the Breadcrumb…
camilleislasse Nov 14, 2026
3abb848
refactor(shadcn-admin-ui): render the avatars with the Avatar components
camilleislasse Nov 14, 2026
a802ddc
refactor(shadcn-admin-ui): render the menu search with the Sidebar:In…
camilleislasse Nov 14, 2026
0eb19f7
refactor(shadcn-admin-ui): render the grid table with the Card and Ta…
camilleislasse Nov 14, 2026
39d9152
refactor(shadcn-admin-ui): render the filter buttons with the Button …
camilleislasse Nov 14, 2026
fc15e86
refactor(shadcn-admin-ui): render the accordion with the Card and Col…
camilleislasse Nov 14, 2026
3e01398
refactor(shadcn-admin-ui): render the dropdown macros with the Dropdo…
camilleislasse Nov 14, 2026
4806106
fix(shadcn-admin-ui): color the apply_transition actions with the pal…
camilleislasse Nov 14, 2026
986ec2d
fix(shadcn-admin-ui): keep a single accordion item open and link each…
camilleislasse Nov 14, 2026
b726a02
docs(shadcn-admin-ui): explain how to replace the Bootstrap JavaScrip…
camilleislasse Nov 14, 2026
e343a2d
test(shadcn-admin-ui): port the copy components tests of BootstrapAdm…
camilleislasse Nov 14, 2026
3d21623
docs(shadcn-admin-ui): use a neutral example for the branding configu…
camilleislasse Nov 14, 2026
c8e6ec0
fix(shadcn-admin-ui): open the custom trigger dropdown with Enter and…
camilleislasse Nov 14, 2026
2b5adc1
chore(shadcn-admin-ui): sync Sidebar/GroupLabel with UX Toolkit 3.7.1
camilleislasse Nov 14, 2026
61bc5eb
fix(shadcn-admin-ui): make html_attr_type('sst') mergeable under Symf…
camilleislasse Nov 16, 2026
db13b59
fix(shadcn-admin-ui): do not render an empty href on dropdown buttons
camilleislasse Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions assets/scripts/statistics_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ function renderChart() {
}

const styles = getComputedStyle(document.documentElement);
const labelColor = styles.getPropertyValue('--tblr-body-color').trim();
const primaryColor = styles.getPropertyValue('--tblr-primary').trim();
const cssVar = (...names) => names.map((name) => styles.getPropertyValue(name).trim()).find(Boolean);
const labelColor = cssVar('--tblr-body-color', '--foreground');
const primaryColor = cssVar('--tblr-primary', '--primary');

const options = {
colors: [primaryColor],
Expand Down Expand Up @@ -121,7 +122,7 @@ if (element) {

const themeObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === 'data-bs-theme') {
if (mutation.attributeName === 'data-bs-theme' || mutation.attributeName === 'data-theme') {
chart.destroy();
renderChart();
}
Expand Down
1 change: 1 addition & 0 deletions bin/switch-admin-theme
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ if [[ ${#themes[@]} -gt 0 ]]; then
printf ' themes: [%s]\n' "${list%, }" >> "$config"
fi

rm -rf var/cache/*
php bin/console cache:clear --quiet

# PHP-FPM only revalidates the cached PHP files every 2 seconds (opcache.revalidate_freq): wait for the new container.
Expand Down
12 changes: 12 additions & 0 deletions bin/switch-admin-ui
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,25 @@ imports:
- { resource: '../../src/${Ns}AdminUi/config/app.php' }
EOF

if [[ "$to" == shadcn ]]; then
cat > config/packages/app_shadcn_templates.yaml <<EOF
twig:
paths:
'%kernel.project_dir%/templates/shadcn': ~
EOF
else
rm -f config/packages/app_shadcn_templates.yaml
fi

# Template namespace and component prefix used by the application.
grep -rlE "@Sylius${OldNs}AdminUi|sylius_${old_prefix}_admin_ui:" app templates config 2>/dev/null \
| { grep -v '^templates/shadcn/' || true; } \
| xargs -r perl -pi -e "s/\@Sylius${OldNs}AdminUi/\@Sylius${Ns}AdminUi/g; s/sylius_${old_prefix}_admin_ui:/sylius_${prefix}_admin_ui:/g"

# The shadcn theme fully replaces the Tom Select stylesheet.
perl -pi -e "s#(\"tom-select/dist/css/tom-select.default.css\": )(true|false)#\${1}${tom_select}#" assets/controllers.json

rm -rf var/cache/*
php bin/console cache:clear --quiet

# PHP-FPM only revalidates the cached PHP files every 2 seconds (opcache.revalidate_freq): wait for the new container.
Expand Down
20 changes: 20 additions & 0 deletions docs/cookbook/admin_panel/basic_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ return static function (ContainerConfigurator $container): void {
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="BootstrapAdminUi" %}
{% code title="templates/book/show/content/body.html.twig" overflow="wrap" lineNumbers="true" %}
```twig
{% set book = hookable_metadata.context.book %}
Expand All @@ -328,6 +330,24 @@ return static function (ContainerConfigurator $container): void {
</div>
```
{% endcode %}
{% endtab %}

{% tab title="ShadcnAdminUi" %}
{% code title="templates/book/show/content/body.html.twig" overflow="wrap" lineNumbers="true" %}
```twig
{% set book = hookable_metadata.context.book %}

<twig:shadcn:Card>
<twig:shadcn:Card:Content>
<p>
{{ book.description|nl2br }}
</p>
</twig:shadcn:Card:Content>
</twig:shadcn:Card>
```
{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Note that you can also [replace the default title](page_titles.md).
Expand Down
22 changes: 22 additions & 0 deletions docs/cookbook/admin_panel/grid_export.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ final class BookGrid extends AbstractGrid

You can configure the template for the export action

{% tabs %}
{% tab title="BootstrapAdminUi" %}
{% code title="templates/shared/grid/action/export.html.twig" lineNumbers="true" %}
```twig
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('export')), options.link.parameters|default([]))) %}
Expand All @@ -223,6 +225,26 @@ You can configure the template for the export action
</a>
```
{% endcode %}
{% endtab %}

{% tab title="ShadcnAdminUi" %}
{% code title="templates/shared/grid/action/export.html.twig" lineNumbers="true" %}
```twig
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('export')), options.link.parameters|default([]))) %}

{% set message = action.label %}
{% if message is empty %}
{% set message = 'app.ui.export' %}
{% endif %}

<twig:shadcn:Button as="a" variant="outline" href="{{ path }}?{{ app.request.query.all()|url_encode }}">
<twig:ux:icon name="{{ action.icon|default('lucide:file-spreadsheet') }}" data-icon="inline-start" />
{{ message|trans }}
</twig:shadcn:Button>
```
{% endcode %}
{% endtab %}
{% endtabs %}

## Configure the translation key

Expand Down
8 changes: 8 additions & 0 deletions docs/cookbook/admin_panel/logo.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {

```

{% hint style="info" %}
With ShadcnAdminUi, the logo is configured without a template: see [Branding](../../shadcn-admin-ui/configuration.md#branding-logo-name-title).
{% endhint %}

## How to customize the login page logo

To customize the login page logo,you need to set new logo template at `sylius_admin.security.login.logo` twig hook. Choose the YAML or the PHP version.
Expand Down Expand Up @@ -108,3 +112,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
```twig
<img src="{{ asset('images/logo.png') }}" alt="Your Brand name" class="sylius navbar-brand-image">
```

{% hint style="info" %}
With ShadcnAdminUi, the logo is configured without a template: see [Branding](../../shadcn-admin-ui/configuration.md#branding-logo-name-title).
{% endhint %}
23 changes: 23 additions & 0 deletions docs/cookbook/admin_panel/state_machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ the workflow configuration you set up.
You can also include your transition button actions in any Twig template by leveraging the `workflow_can` function. The button
will only be generated when your Symfony Workflow config allows it.

{% tabs %}
{% tab title="BootstrapAdminUi" %}
{% code lineNumbers=true %}
```twig
{% if workflow_can(application, 'cancel') %}
Expand All @@ -443,3 +445,24 @@ will only be generated when your Symfony Workflow config allows it.
{% endif %}
```
{% endcode %}
{% endtab %}

{% tab title="ShadcnAdminUi" %}
{% code lineNumbers=true %}
```twig
{% if workflow_can(application, 'cancel') %}
<form method="post" action="{{ path('app_admin_application_cancel', {id: application.id}) }}">
<input type="hidden" name="_token"
value="{{ csrf_token('apply_transition') }}">
<twig:shadcn:Button type="submit" variant="ghost" size="icon-sm"
title="{{ 'app.ui.application.cancel'|trans }}"
>
<twig:ux:icon name="streamline-stickies-color:cancel-2" />
<span class="sr-only">{{ 'app.ui.application.cancel'|trans }}</span>
</twig:shadcn:Button>
</form>
{% endif %}
```
{% endcode %}
{% endtab %}
{% endtabs %}
29 changes: 17 additions & 12 deletions docs/shadcn-admin-ui/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Same macro APIs as `@SyliusBootstrapAdminUi`: only the namespace changes.
| `dropdown.html.twig` | `default(params)`, `list(params, items)`, `item(attributes, content, variant)` |
| `table.html.twig` | `headers`, `row` |
| `pagination.html.twig` | `simple(paginator, options)`, `results_count(paginator)` |
| `accordion.html.twig` | `accordion(items, open, auto_close, flush)` |
| `avatar.html.twig` | `default(img, class, initials)`, `small(img, class, initials)` |
| `accordion.html.twig` | `accordion(items, open, auto_close, flush)`: `auto_close: false` keeps several items open, no `flag` item option |
| `avatar.html.twig` | `default(img, class, initials, size)`, `small(img, class, initials)` |
| `palette.html.twig` | [`tone(color, kind)`](theming.md#the-tone-macro) |

The button macros accept an extra `variant` param: `default`, `secondary`, `outline`, `ghost`, `destructive`, `link`.
Expand Down Expand Up @@ -121,6 +121,7 @@ Registered automatically by the bundle.
| Identifier | Role |
|---------------------------------------------|------------------------------------------------------------------|
| `admin--tabs` | Accessible tabs ([see above](#tabs)) |
| `admin--accordion` | Keeps a single item of the `accordion()` macro open |
| `admin--grid-selection` | Row selection, "select all", bulk action forms |
| `admin--copy-to-clipboard` | Copy buttons |
| `admin--dismissible` | Closable flash messages and alerts |
Expand Down Expand Up @@ -180,27 +181,31 @@ To add a new recipe, pass its name.
The files are **overwritten**: `git diff` shows both the changes of the kit and the local changes of the bundle that
were lost. Keep the former, restore the latter (`git checkout -p`).

Local changes to restore after an update (as of UX Toolkit 3.6):
Local changes to restore after an update (as of UX Toolkit 3.7):

| File | Local change |
|------------------------------------------------------------|------------------------------------------------------------------------------|
| `DropdownMenu/{Item,CheckboxItem,RadioItem,SubTrigger}` | `cursor-pointer` instead of `cursor-default` |
| `DropdownMenu/Content` | `left` / `right` sides combined with `align` (`start`, `center`, `end`) |
| `dropdown_menu_controller.js` | A pointer click focuses the menu, not its first item (no highlighted item) |
| `Sidebar` | Nested sidebar (`sidebar.nested`: `<div>` instead of `<aside>`), `p-2` around `floating` / `inset` |
| `Sidebar/Content` | Hidden scrollbar, no overflow clipping while a dropdown menu is open |
| `Sidebar/GroupLabel` | `as` prop (`div` or `button`, to toggle a `Collapsible`) |
| `Sidebar/MenuButton` | `[&_svg]` instead of `[&>svg]` (nested icons are sized too) |

Update this table when you add or drop a local change.

{% hint style="warning" %}
Classes copied outside the components must be synced **by hand**:

- `shared/helper/ui.html.twig`
- `shared/form_theme.html.twig`
- `shared/crud/common/sidebar/menu/menu.html.twig`
- `shared/pagerfanta.html.twig`
- `shared/helper/ui.html.twig`: `Button`
- `shared/form_theme.html.twig`: `Field`, `Input`, `Checkbox`, `Switch`, `NativeSelect`, `Alert`
- `shared/crud/common/sidebar/menu/menu.html.twig`: `Sidebar`, `Collapsible`
- `shared/pagerfanta.html.twig`: `Pagination`, `Button`
- `shared/components/badge.html.twig`: `Badge`
- `shared/components/confirmation_modal.html.twig`: `AlertDialog`, `Dialog/Footer`
- `shared/crud/index/content/grid/filters.html.twig`: `Card`, `Collapsible`
- `shared/crud/index/content/grid/no_results.html.twig`: `Empty`
- `shared/crud/index/content/grid/no_results/image.html.twig`: `Empty/Media`
- `shared/helper/_checkbox.html.twig`: `Checkbox`
- `shared/helper/header.html.twig`: `Empty/Media`
- `shared/helper/sorting.html.twig`: `Table/Head`
- `shared/helper/table.html.twig`: `Table`
{% endhint %}

### 4. Check
Expand Down
10 changes: 5 additions & 5 deletions docs/shadcn-admin-ui/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ sylius_twig_hooks:
'sylius_admin.common.component.sidebar.logo':
image:
configuration:
name: 'Camalo'
subtitle: 'WMS'
icon: 'lucide:warehouse' # or image: 'images/logo.svg'
name: 'Acme'
subtitle: 'Back office'
icon: 'lucide:store' # or image: 'images/logo.svg'
'sylius_admin.security.login.page.logo':
image:
configuration: { name: 'Camalo', icon: 'lucide:warehouse' }
configuration: { name: 'Acme', icon: 'lucide:store' }
'sylius_admin.base#base_title':
default:
configuration: { title: 'Camalo' }
configuration: { title: 'Acme' }
```
{% endcode %}

Expand Down
8 changes: 8 additions & 0 deletions docs/shadcn-admin-ui/grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Sylius grids are rendered as a shadcn data table with:
- filters `string`, `boolean`, `date`, `enum`, `entity`, `exists`, `select`;
- a card layout below the `md` breakpoint.

The `class` option of an `apply_transition` action colors its (single-color) icon with a
[palette](theming.md#the-tone-macro) color: `success`, `danger`, `warning`, `info`, `green`, `red`… The `outline-` and
`ghost-` prefixes of BootstrapAdminUi are ignored, and an unknown color renders as `secondary`.

```php
ApplyTransitionAction::create(name: 'accept', route: 'app_admin_application_accept', options: ['class' => 'success']);
```

## Column options

Cells are `whitespace-nowrap`: the table scrolls horizontally when needed. A field's `vars` option accepts:
Expand Down
19 changes: 17 additions & 2 deletions docs/shadcn-admin-ui/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,26 @@ is a search and replace.

4. **Rewrite Bootstrap classes** of your custom templates with Tailwind utilities.

5. **Icons**: nothing to do. `tabler:*` names keep working through UX Icons; the theme itself uses `lucide:*`.
5. **Replace the Bootstrap JavaScript**: it is not loaded, so the `data-bs-*` attributes of your templates stop
working, without any error.

| BootstrapAdminUi | Shadcn Admin UI |
|--------------------------------|---------------------------------------------------------------------|
| `data-bs-toggle="modal"` | `<twig:shadcn:Dialog>` or `<twig:shadcn:AlertDialog>` |
| `data-bs-toggle="tab"` | The `admin--tabs` controller (see [Tabs](components.md#tabs)) |
| `data-bs-toggle="dropdown"` | `<twig:shadcn:DropdownMenu>` or the `dropdown` macros |
| `data-bs-toggle="tooltip"` | `<twig:shadcn:Tooltip>`, or a `title` attribute |
| `data-bs-toggle="collapse"` | `<twig:shadcn:Collapsible>` or the `accordion` macro |
| `data-bs-dismiss="modal"` | `<twig:shadcn:AlertDialog:Cancel>`, or `dialog_close_attrs` of `<twig:shadcn:Dialog:Close>` on a button |
| `data-bs-dismiss="alert"` | `data-controller="admin--dismissible"` on the alert and `data-action="admin--dismissible#close"` on its close button |

6. **Icons**: nothing to do. `tabler:*` names keep working through UX Icons; the theme itself uses `lucide:*`.

{% hint style="info" %}
Find what is left to migrate:

```bash
grep -rn "SyliusBootstrapAdminUi\|sylius_bootstrap_admin_ui" templates config
grep -rn "SyliusBootstrapAdminUi\|sylius_bootstrap_admin_ui\|data-bs-" templates config
```
{% endhint %}

Expand All @@ -53,8 +66,10 @@ grep -rn "SyliusBootstrapAdminUi\|sylius_bootstrap_admin_ui" templates config
| Change | Hook / hookable |
|------------|-------------------------------------------------------------------------------------|
| ➖ Removed | `toggle_button` hookable of the sidebar |
| ➖ Removed | `symfony_ux` hookables of `sylius_admin.base#stylesheets` and `sylius_admin.base#javascripts` (Stimulus and the Symfony UX controllers are started by the `admin` importmap entrypoint, the Tom Select styles are in `theme.css`) |
| ➕ Added | `sylius_admin.common.component.navbar.sidebar_trigger` (the toggle, now in the navbar) |
| ➕ Added | `sylius_admin.base#metatags.color_scheme` |
| ➕ Added | `sylius_admin.base#stylesheets.themes` (the color themes, see [Theming](theming.md)) |

{% hint style="info" %}
List the hookables of a page to check your overrides:
Expand Down
18 changes: 18 additions & 0 deletions src/ShadcnAdminUi/assets/controllers/admin/accordion_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Controller } from '@hotwired/stimulus';

/** Keeps a single item open in an accordion of shadcn Collapsible items: opening one closes the others. */
export default class extends Controller {
closeOthers(event) {
const item = event.currentTarget.closest('[data-controller~="shadcn--collapsible"]');

if (item?.parentElement !== this.element || item.getAttribute('data-shadcn--collapsible-open-value') !== 'true') {
return;
}

for (const other of this.element.querySelectorAll(':scope > [data-controller~="shadcn--collapsible"]')) {
if (other !== item) {
other.setAttribute('data-shadcn--collapsible-open-value', 'false');
}
}
}
}
Loading