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

Label

Étiquette de formulaire avec indicateurs et tooltip

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

Usage

Le composant Label est une étiquette autonome pour les champs de formulaire. Utilisez-le quand vous avez besoin d'un label séparé du champ (ex: layouts custom, fieldsets).

{% verbatim %}{# Label simple #}
{% include '_atoms/form/label.html.twig' with {
    text: 'Adresse email',
    for: 'email'
} %}

{# Label obligatoire avec tooltip #}
{% include '_atoms/form/label.html.twig' with {
    text: 'Mot de passe',
    for: 'password',
    required: true,
    tooltip: 'Minimum 8 caractères'
} %}{% endverbatim %}

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

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

Tailles

Paramètre : size

{% include '_atoms/form/label.html.twig' with { text: 'Small (sm)', size: 'sm' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Medium (md) - défaut', size: 'md' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Large (lg)', size: 'lg' } %}
{# ===== VARIANTES ===== #}

Variantes

Paramètre : variant

{% include '_atoms/form/label.html.twig' with { text: 'Default - Label principal', variant: 'default' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Secondary - Label secondaire', variant: 'secondary' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Inline - Sur la même ligne', variant: 'inline' } %}
{# ===== INDICATEURS ===== #}

Indicateurs

Paramètres : required, optional

{% include '_atoms/form/label.html.twig' with { text: 'Champ normal' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Champ obligatoire', required: true } %}
{% include '_atoms/form/label.html.twig' with { text: 'Champ optionnel', optional: true } %}
{% include '_atoms/icon/icon.html.twig' with { name: 'info', size: 'sm', color: 'info' } %}

Accessibilité : L'astérisque obligatoire inclut un sr-only pour les lecteurs d'écran.

{# ===== AVEC ICÔNE ===== #}

Avec icône

Paramètre : icon

{% include '_atoms/form/label.html.twig' with { text: 'Fichier', icon: 'file-text' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Email', icon: 'mail', required: true } %}
{% include '_atoms/form/label.html.twig' with { text: 'Mot de passe', icon: 'lock', required: true } %}
{% include '_atoms/form/label.html.twig' with { text: 'Recherche', icon: 'search', optional: true } %}
{# ===== AVEC TOOLTIP ===== #}

Avec tooltip

Paramètre : tooltip

{% include '_atoms/form/label.html.twig' with { text: 'Mot de passe', required: true, tooltip: 'Minimum 8 caractères avec une majuscule et un chiffre' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Clé API', tooltip: 'Trouvez votre clé API dans les paramètres de votre compte' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Webhook URL', icon: 'settings', optional: true, tooltip: 'URL appelée lors des événements' } %}
{% verbatim %}{% include '_atoms/form/label.html.twig' with {
    text: 'Mot de passe',
    required: true,
    tooltip: 'Minimum 8 caractères'
} %}{% endverbatim %}
{# ===== ÉTATS ===== #}

États

Paramètre : disabled

{% include '_atoms/form/label.html.twig' with { text: 'Label actif' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Label désactivé', disabled: true } %}
{% include '_atoms/form/label.html.twig' with { text: 'Désactivé avec icône', icon: 'lock', disabled: true } %}
{# ===== EXEMPLE FORMULAIRE ===== #}

Exemple : Formulaire avec labels séparés

{% include '_atoms/form/label.html.twig' with { text: 'Informations personnelles', size: 'lg', variant: 'default' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Prénom', for: 'firstname', required: true, size: 'sm' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Nom', for: 'lastname', required: true, size: 'sm' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Email', for: 'email', icon: 'mail', required: true, tooltip: 'Utilisé pour la connexion' } %}
{% include '_atoms/form/label.html.twig' with { text: 'Téléphone', for: 'phone', icon: 'power', optional: true } %}
{# ===== PARAMÈTRES ===== #}

Paramètres

Paramètre Type Défaut Description
textstring(requis)Texte du label
forstringnullID du champ associé
sizestring'md'sm, md, lg
variantstring'default'default, secondary, inline
requiredboolfalseAffiche l'astérisque *
optionalboolfalseAffiche (optionnel)
iconstringnullNom de l'icône
tooltipstringnullTexte d'info-bulle
disabledboolfalseStyle désactivé
{% endblock %}