Installation
Requirements
Section titled “Requirements”| Dependency | Version |
|---|---|
| PHP | 8.2+ |
Symfony (framework-bundle, twig-bundle), for the bundle |
6.4 / 7.x / 8.x |
| Symfony UX Twig Component | 2.21+ / 3.x |
Twig (twig/twig) |
3.15+ / 4.x |
Twig extensions (twig/html-extra) |
3.12+ / 4.x |
| Symfony UX Icons, optional | 2.17+ / 3.x |
The bundle registers html_cva() (twig/html-extra) unless twig/extra-bundle already does. An application without
a Symfony kernel can render the components in a plain Twig environment from UX Twig Component 3.2 (PHP 8.4+): see
Without the bundle in the README.
Installation
Section titled “Installation”composer require silarhi/tabler-ux-componentsIf your app uses Symfony Flex, the bundle is registered automatically. Otherwise add it to config/bundles.php:
return [ // ... Silarhi\TablerUxComponents\TablerUxComponentsBundle::class => ['all' => true],];The components live under components/Tabler/ and are resolved by Twig Component’s anonymous component finder. On
ux-twig-component v3, twig_component.defaults and twig_component.anonymous_template_directory must be configured
explicitly (on v2 they are optional). The Flex recipe already does it:
twig_component: anonymous_template_directory: 'components/' defaults: App\Twig\Components\: 'components/'With the Symfony UX Toolkit
Section titled “With the Symfony UX Toolkit”Rather than depending on the bundle, copy the components you need into your app with the
Symfony UX Toolkit. Each component is a recipe of the
silarhi/tabler-ux-kit kit, published on each release:
composer require --dev symfony/ux-toolkit symfony/http-clientphp bin/console ux:install alert --kit=github.com/silarhi/tabler-ux-kitux:install copies the templates of the component, and of the components it renders (Alert brings Icon), to
templates/components/Tabler/, and lists the Composer packages they need. They are used the same way, as
<twig:Tabler:Alert>, and they are yours to edit: run ux:install again to compare them with a newer release. Pin a
release with --kit=github.com/silarhi/tabler-ux-kit:<version>, one of the kit’s
tags (the bundle’s version without the v).
The Toolkit downloads the kit from GitHub with symfony/http-client and PHP’s zip extension, and requires PHP 8.4+
and Symfony 7.4+; it is only needed to install the components, not to render them. Install either the kit or the
bundle, not both: they provide the same components. The front-end setup below is the same.
Front-end
Section titled “Front-end”Your app must load Tabler 1.6+ (@tabler/core): its CSS, and tabler.js for the
interactive components (Modal, Dropdown, Carousel, Tabs, Offcanvas, Tooltip, Popover, Clipboard, Sparkline…). The
components added for Tabler 1.7 (Kbd, NumberInput, HoverGallery, Nav overflow…) say “Requires Tabler 1.7+” on their
page. Flag also needs Tabler’s tabler-flags.css.
pnpm add @tabler/core @tabler/icons-webfontimport '@tabler/core/dist/css/tabler.min.css'import '@tabler/icons-webfont/dist/tabler-icons.min.css'import '@tabler/core'Icon and the icon props render a Tabler icon name (home) with the
@tabler/icons-webfont font. Filled icons (<twig:Tabler:Icon filled>) need its filled
font as well (3.36.1+), compiled under its own prefix: see Filled.
A name with an icon set prefix (tabler:home, lucide:circle-check) is rendered as an inline SVG by
Symfony UX Icons instead, an optional dependency:
composer require symfony/ux-icons. See
Icons from symfony/ux-icons.
First component
Section titled “First component”<twig:Tabler:Alert variant="success" title="Saved!" description="Your changes are live." />Every component is documented with a live preview, its Twig source and the HTML it renders. Read Composition first: all components share the same building blocks.
