Skip to content

v.0.9.7

Compare
Choose a tag to compare
@wrabit wrabit released this 21 Jun 06:15
· 496 commits to main since this release

What's Changed

Passing Python data types

Using the : to prefix an attribute tells Cotton we're passing a dynamic type down. We already know we can use this to send a variable, but you can also send basic python types, namely:

  • Integers and Floats
  • None
  • True and False
  • Lists
  • Dictionaries

This benefits a number of use-cases, for example if you have a select component that you want to provide some value:

<!-- select.cotton.html -->
<select {{ attrs }}>
    {% for option in options %}
        <option value="{{ option }}">{{ option }}</option>
    {% endfor %}
</select>

<c-select name="q1" :options="['yes', 'no', 'maybe']" />
<!-- output -->
<select name="q1">
    <option value="yes">yes</option>
    <option value="no">no</option>
    <option value="maybe">maybe</option>
</select>

More

Full Changelog: v.0.9.6...v.0.9.7