djust-theming | Demo Home Components | Gallery Storybook Editor Diff

Textarea

1 required 9 optional 4 slots 1 a11y rule
LIVE PREVIEW 1
textarea(name=gallery_textarea, label=Textarea, placeholder=Write something..., rows=4)
USAGE
template
{%{% endverbatim %} load theme_components {% verbatim %}%}

{%{% endverbatim %} theme_{{ name }}{% for p in required_context %} {{ p.name }}{% endfor %}{% for p in optional_context %} {{ p.name }}={{ p.default|default:"..." }}{% endfor %} {% verbatim %}%}
PROPS — REQUIRED 1
NameTypeDefault
name str
PROPS — OPTIONAL 9
NameTypeDefault
label Optional[str]
placeholder str
rows int 4
css_prefix str
attrs dict
slot_label str
slot_textarea str
slot_help_text str
slot_error str
ACCESSIBILITY 1
RequirementElementAttributeValue
Label must reference textarea via for attribute label for (present)
AVAILABLE SLOTS 4
slot_label slot_textarea slot_help_text slot_error
TEMPLATE SOURCE
textarea.html
<div class="{{ css_prefix }}textarea-group {% if attrs.class %}{{ attrs.class }}{% endif %}">
    {% if slot_label %}
    {{ slot_label|safe }}
    {% elif label %}
    <label for="{{ name }}" class="{{ css_prefix }}textarea-label">{{ label }}</label>
    {% endif %}
    {% if slot_textarea %}
    {{ slot_textarea|safe }}
    {% else %}
    <textarea
        name="{{ name }}"
        id="{{ name }}"
        placeholder="{{ placeholder }}"
        rows="{{ rows }}"
        class="{{ css_prefix }}textarea"
        {% if attrs.required %}required{% endif %}
        {% if attrs.disabled %}disabled{% endif %}
        {% if attrs.readonly %}readonly{% endif %}
    >{% if attrs.value %}{{ attrs.value }}{% endif %}</textarea>
    {% endif %}
    {% if slot_help_text %}
    <div class="{{ css_prefix }}textarea-help">{{ slot_help_text|safe }}</div>
    {% endif %}
    {% if slot_error %}
    <div class="{{ css_prefix }}textarea-error" role="alert">{{ slot_error|safe }}</div>
    {% endif %}
</div>