Examples

Note that all examples are deliberately left unstyled to present the simplest implementation.

Count characters

Character count: 5

Source

<!-- unicorn/templates/unicorn/count-characters.html -->
<div>
    <p>
        <input type="text" unicorn:model="name" id="character-count"></input>
    </p>
    <p>
        Character count: {{ name|length }}
    </p>
</div>
# unicorn/components/count_characters.py
from django_unicorn.components import UnicornView


class CountCharactersView(UnicornView):
    name = "World"