sensiolabs / StorybookBundle

MIT License
41 stars 5 forks source link

content block for twig components #29

Closed flauschke closed 4 months ago

flauschke commented 4 months ago

I tried to use some of my existing components. I use the content block of the component e.g. as the button label:

<{{tag}}
    {{ attributes.defaults({ class: classes|join(' ') }) }}
    {% if title %} name='{{ title }}'{% endif %}
    {% if url %} href='{{ url }}'{% endif %}
    {% if url and target %} target='{{ target }}'{% endif %}
    {% if tooltip %} data-content='{{ tooltip }}'{% endif %}
>
    <span>
        {% block content %}{% endblock %}
    </span>

</{{tag}}>

How can I pass text for the block in the story.js ? Is it just missing from the docs or not supported yet?

I know the project is very young and in active development but it would be helpful to know if this is coming or not or if I just missed something in the docs.

squrious commented 4 months ago

Hi, you can provide a custom template in your story to handle a such case: https://github.com/sensiolabs/StorybookBundle/blob/main/docs/features/csf-stories.md#using-a-component-in-custom-template

flauschke commented 4 months ago

Thank you - I didn't read properly