@@ -676,14 +676,13 @@ the subdirectory:
676676 {# renders as: #}
677677 <button class="primary">Click Me!</button>
678678
679- If your component lives in a directory with the same name, you can
679+ If your anonymous component lives in a directory with the same name, you can
680680name the component file ``index.html.twig `` to avoid repetition:
681681
682682.. code-block :: html+twig
683683
684684 {# templates/components/Menu/index.html.twig #}
685- ...
686- <nav {{ attributes.defaults({class: 'navbar'}) }}>
685+ <nav {{ attributes.defaults({class: 'menu'}) }}>
687686 <ul>
688687 {% block content %}{% endblock %}
689688 </ul>
@@ -692,28 +691,25 @@ name the component file ``index.html.twig`` to avoid repetition:
692691.. code-block :: html+twig
693692
694693 {# templates/components/Menu/Item.html.twig #}
695- ...
696- {% props href %}
697- <li {{ attributes.defaults({class: 'navitem'}) }}>
698- <a href="{{ href }}">{% block content %}{% endblock %}</a>
694+ {% props href, label %}
695+ <li {{ attributes.defaults({class: 'menu__item'}) }}>
696+ <a href="{{ href }}">{% block content %}{{ label }}{% endblock %}</a>
699697 </li>
700698
701699.. code-block :: html+twig
702700
703701 {# index.html.twig #}
704702 ...
705- <div>
706- <twig:Menu>
707- <twig:Menu: Item href="/">Home</twig:Menu: Item>
708- <twig:Menu: Item href="/about">About</twig:Menu: Item>
709- </twig:Menu>
710- </div>
703+ <twig:Menu>
704+ <twig:Menu: Item href="/">Home</twig:Menu: Item>
705+ <twig:Menu: Item href="/about">About</twig:Menu: Item>
706+ </twig:Menu>
711707
712708 {# renders as: #}
713- <nav class="navbar ">
709+ <nav class="menu ">
714710 <ul>
715- <li class="navitem "><a href="/">Home</a></li>
716- <li class="navitem "><a href="/about">About</a></li>
711+ <li class="menu__item "><a href="/">Home</a></li>
712+ <li class="menu__item "><a href="/about">About</a></li>
717713 </ul>
718714 </nav>
719715
0 commit comments