Closed bal-sm closed 23 hours ago
and also can we work on how to properly define variation so we can just:
<c-button:red>Delete account</c-button:red>
@bal-sm , @wrabit wrote a guide on creating variations for components. It's worth a read :).
https://medium.com/@willabbott/django-cotton-component-variants-for-smarter-reusability-07d8e4358ed0
Hi @bal-sm, for now you will need to manage defaults this way:
{% if named_slot %}
{{ named_slot }}
{% else %}
my default
{% endif %}
I would like to simplify the syntax and align it to Vue for example, (see here) but nothing is planned in this moment..
About your suggested syntax of variation - there would be no way to say what you are configuring (a component could have many types of variation) so the keyed approach seems to be the most logical for now.
It will be really helpful and cool, I think.
I mean if it can also have multi-lined
html
content as default value in some different tag thanc-vars
, perhaps?