{% extends 'base.html.twig' %} {% block title %}Textarea - Design System - Bubul{% endblock %} {% block body %}
{# ===== HEADER ===== #}
Atomes / Form /

Textarea

Champ de saisie multiligne avec compteur de caractères

{# ===== USAGE ===== #}

Usage

{% verbatim %}{# Textarea simple #}
{% include '_atoms/form/textarea.html.twig' with {
    label: 'Description',
    placeholder: 'Décrivez votre projet...',
    rows: 4
} %}

{# Avec compteur de caractères #}
{% include '_atoms/form/textarea.html.twig' with {
    label: 'Bio',
    maxlength: 280,
    showCount: true
} %}{% endverbatim %}

Fichier : templates/_atoms/form/textarea.html.twig

{# ===== TAILLES ===== #}

Tailles

Paramètre : size

{% include '_atoms/form/textarea.html.twig' with { label: 'Small (sm)', size: 'sm', placeholder: 'Taille small...', rows: 2 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Medium (md) - défaut', size: 'md', placeholder: 'Taille medium...', rows: 3 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Large (lg)', size: 'lg', placeholder: 'Taille large...', rows: 3 } %}
{# ===== VARIANTES ===== #}

Variantes

Paramètre : variant

{% include '_atoms/form/textarea.html.twig' with { label: 'Default', variant: 'default', placeholder: 'Bordure visible...', rows: 3 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Filled', variant: 'filled', placeholder: 'Fond gris...', rows: 3 } %}
{# ===== ROWS ===== #}

Nombre de lignes

Paramètre : rows

{% include '_atoms/form/textarea.html.twig' with { label: '2 lignes', rows: 2, placeholder: 'Court...' } %} {% include '_atoms/form/textarea.html.twig' with { label: '4 lignes (défaut)', rows: 4, placeholder: 'Moyen...' } %} {% include '_atoms/form/textarea.html.twig' with { label: '8 lignes', rows: 8, placeholder: 'Long...' } %}
{# ===== RESIZE ===== #}

Redimensionnement

Paramètre : resize

{% include '_atoms/form/textarea.html.twig' with { label: 'None', resize: 'none', placeholder: 'Non redimensionnable', rows: 3 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Vertical (défaut)', resize: 'vertical', placeholder: 'Hauteur ajustable', rows: 3 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Both', resize: 'both', placeholder: 'Libre', rows: 3 } %}
{# ===== COMPTEUR ===== #}

Compteur de caractères

Paramètres : maxlength, showCount

{% include '_atoms/form/textarea.html.twig' with { label: 'Bio Twitter', placeholder: 'Présentez-vous en quelques mots...', maxlength: 160, showCount: true, hint: 'Maximum 160 caractères', rows: 3 } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Message court', placeholder: 'Votre message...', maxlength: 280, showCount: true, rows: 4, value: 'Ceci est un exemple de texte pré-rempli pour montrer le compteur de caractères en action.' } %}
{# ===== ÉTATS ===== #}

États

{% include '_atoms/form/textarea.html.twig' with { label: 'Normal', placeholder: 'Entrez du texte...' } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Avec hint', placeholder: 'Entrez du texte...', hint: 'Ce texte aide l\'utilisateur' } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Obligatoire', placeholder: 'Entrez du texte...', required: true } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Avec erreur', placeholder: 'Entrez du texte...', error: 'Ce champ est obligatoire' } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Désactivé', placeholder: 'Non modifiable', disabled: true, value: 'Contenu fixe' } %} {% include '_atoms/form/textarea.html.twig' with { label: 'Lecture seule', readonly: true, value: 'Ce contenu ne peut pas être modifié mais peut être sélectionné et copié.' } %}
{# ===== PARAMÈTRES ===== #}

Paramètres

Paramètre Type Défaut Description
labelstringnullTexte du label
placeholderstring''Placeholder
valuestring''Valeur initiale
rowsnumber4Nombre de lignes
sizestring'md'sm, md, lg
variantstring'default'default, filled
resizestring'vertical'none, vertical, both
maxlengthnumbernullLimite de caractères
showCountboolfalseAfficher le compteur
requiredboolfalseChamp obligatoire
disabledboolfalseChamp désactivé
errorstringnullMessage d'erreur
hintstringnullTexte d'aide
{% endblock %}