twig-component

Create reusable Symfony UI components with TwigComponent using props, slots, and lifecycle hooks.

5|1|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/ineersa/re-search --skill twig-component-ineersa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: twig-component
Source: https://github.com/ineersa/re-search/tree/main/.cursor/skills/twig-component
Command: npx skills add https://github.com/ineersa/re-search --skill twig-component-ineersa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TwigComponents in Symfony projects help teams build reusable, consistent UI elements without duplicating logic or markup, reducing maintenance and rendering inconsistencies across the app.

Core Features & Use Cases

  • Class-based components with PHP backing classes and Twig templates for reusable, logic-enabled UI elements.
  • Anonymous Twig components for lightweight, template-driven UI blocks that require no PHP logic.
  • Props, slots, blocks, computed properties, and lifecycle hooks to compose complex interfaces from simple parts.
  • Integration with Symfony UX patterns to support consistent design systems across many pages.

Quick Start

Create a reusable UI element with a PHP-backed class and a Twig template, then render it with <twig:YourComponent /> or the equivalent anonymous syntax.

Frequently Asked Questions about twig-component

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create reusable Symfony UI components to stop duplicating Twig markup?

Symfony UI components are built using TwigComponent to create class-based or anonymous template-driven elements, reducing duplicated markup and rendering inconsistencies. You define PHP backing classes or lightweight templates and render them with the twig component syntax.

What is the difference between class-based and anonymous Twig components in Symfony?

Class-based Twig components use PHP backing classes for reusable logic-enabled UI elements, while anonymous Twig components are lightweight template-driven UI blocks requiring no PHP logic. Both support props slots and blocks for composing interfaces.

How do I pass data and content into Symfony Twig components?

You pass data and content into Symfony Twig components using props slots and blocks. These features allow you to compose complex interfaces from simple parts by binding variables and injecting nested template content into your reusable UI elements.

Does TwigComponent work with Symfony UX design system patterns?

Yes TwigComponent works with Symfony UX patterns to support consistent design systems across many pages. It integrates reusable UI elements into your Symfony project applying frontmatter requirements and directory references for scripts references and assets.

When should I avoid using reusable Twig components in a Symfony project?

You should avoid reusable Twig components when your UI requires highly dynamic stateful client-side interactivity beyond standard Symfony UX integration or when AsTwigComponent metadata template bindings and lifecycle hooks cannot cleanly map to your rendering requirements.