Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twigcn Bundle

Twigcn Bundle Laravel Package

ducrot/twigcn-bundle

TwigcnBundle brings shadcn/ui-inspired, accessible UI components to Symfony & Twig. Install the PHP bundle plus the @ducrot/twigcn-ui NPM package and compile Tailwind CSS to use ready-made, themeable components in your templates.

View on GitHub
Deep Wiki
Context7

Beautiful, accessible UI components for Symfony & Twig. Inspired by shadcn/ui.

Frequently asked questions about Twigcn Bundle
Can I use TwigcnBundle in Symfony 6.x or older versions?
No, TwigcnBundle officially supports Symfony 7.0+ only. Symfony 6.x would require manual adjustments, but the bundle leverages TwigComponent and AssetMapper features introduced in Symfony 7. Check the [main repository](https://github.com/ducrot/twigcn) for potential backports or alternatives.
What if my project doesn’t use Tailwind CSS? Can I still use this bundle?
No, TwigcnBundle requires Tailwind CSS 4.0+ due to its styling architecture. Without Tailwind, you’d need to fork the bundle and replace Tailwind-specific classes (e.g., `btn-primary`) with your own CSS, which isn’t officially supported. Consider alternatives like [Symfony UX Turbo](https://symfony.com/bundles/ux-turbo/current/index.html) for component-based UI.
How do I customize the theme (e.g., change colors or radii) without breaking updates?
Use CSS custom properties (variables) like `--primary` or `--radius` in your Tailwind config. Override these in your `tailwind.css` file, and the bundle will respect them. Avoid modifying the bundle’s source CSS directly, as updates may overwrite changes. Document your overrides in a `README` or config file.
Is Symfony UX Stimulus required for interactive components (e.g., Dialog, Drawer)?
Yes, interactive components like `Dialog` or `Drawer` depend on Symfony UX Stimulus 2.x+. If your project uses Stimulus 1.x or a custom setup, you’ll need to migrate to Symfony UX Stimulus first. The bundle doesn’t support legacy Stimulus configurations. Check the [Symfony UX docs](https://symfony.com/doc/current/stimulus.html) for migration steps.
How do I integrate TwigcnBundle’s form components with existing Symfony forms (e.g., `{{ form_widget() }}`)?
TwigcnBundle provides components like `FieldForm`, `Input`, and `Checkbox` to replace traditional form rendering. You can mix them with `form_widget()` by embedding Twigcn components inside form rows or using them as standalone replacements. For full adoption, replace all `form_widget()` calls with Twigcn components in your templates. No backend changes are needed.
What’s the performance impact of adding 50+ interactive components to my app?
The bundle adds minimal runtime overhead since components are lazy-loaded via Twig’s TwigComponent system. However, interactive components (e.g., Dialog) include Stimulus controllers, which add ~5–10KB per component to your JavaScript bundle. For critical paths, use `data-twigcn-lazy` to defer loading non-essential components. Monitor your build size with `npm run build -- --stats-json` and optimize Tailwind’s purge config.
How do I set up TwigcnBundle with Webpack Encore instead of AssetMapper?
Encore projects automatically resolve `@ducrot/twigcn-ui` from `node_modules`. Ensure your `webpack.config.js` includes the package in `entry` or `resolve.alias`. No additional steps are needed for the PHP bundle—just install `@ducrot/twigcn-ui` via npm and rebuild assets. Verify Encore’s output includes the compiled CSS and JS for Twigcn components.
Are there any known conflicts with existing Tailwind CSS classes in my project?
Potential conflicts arise if your project uses Tailwind classes like `btn-primary` or `shadow-lg` that overlap with Twigcn’s defaults. Use Tailwind’s `!important` sparingly and audit your `tailwind.config.js` for duplicate or conflicting utilities. The bundle’s `tailwind.css` includes a `@source` directive to scan its templates—exclude your project’s files from this scan if you’ve customized core classes.
Who maintains this bundle, and how can I report issues?
TwigcnBundle is a subtree split of the [main `ducrot/twigcn` repo](https://github.com/ducrot/twigcn), where all issues and PRs must be filed. The bundle itself is read-only on GitHub. For support, open issues in the main repo or check the [discussion tab](https://github.com/ducrot/twigcn/discussions). The MIT license ensures no vendor lock-in, but community adoption is still growing.
Can I use TwigcnBundle with PHP 8.1 or lower? What about Node.js 20?
No, TwigcnBundle requires PHP 8.2+ and Node.js 22+ due to dependencies like Symfony 7.x and Tailwind CSS 4.0+. Downgrading PHP or Node.js will cause installation failures. If your project is constrained by legacy versions, consider waiting for a major release or exploring alternatives like [Symfony UX](https://symfony.com/bundles/ux) components, which support older stacks.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php