{% extends 'base.html.twig' %} {% block title %}User Card - Design System - Bubul{% endblock %} {% block body %}
Molécules /

User Card

Carte utilisateur avec avatar et progress

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

Usage

{% verbatim %}{% include '_molecules/user-card/user-card.html.twig' with {
    name: 'Jean Dupont',
    email: 'jean@example.com',
    role: 'Administrateur',
    progress: 75,
    progressLabel: 'Complété'
} %}{% endverbatim %}
{# ===== EXEMPLES ===== #}

Exemples

{% include '_molecules/user-card/user-card.html.twig' with { name: 'Marie Martin', email: 'marie@bubul.app', role: 'Formatrice', variant: 'bordered' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Pierre Durand', role: 'Développeur', badge: { text: 'Pro', variant: 'primary' }, progress: 85, variant: 'bordered' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Sophie Laurent', email: 'sophie@example.com', role: 'Designer', progress: 100, progressLabel: 'Formation terminée', variant: 'elevated' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Admin User', role: 'Super Admin', badge: { text: 'Admin', variant: 'error' }, actions: [ { icon: 'edit', label: 'Modifier' }, { icon: 'trash', label: 'Supprimer' } ], variant: 'bordered' } %}
{# ===== TAILLES ===== #}

Tailles

{% include '_molecules/user-card/user-card.html.twig' with { name: 'Taille SM', role: 'Utilisateur', size: 'sm', variant: 'bordered' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Taille MD', role: 'Utilisateur', size: 'md', variant: 'bordered' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Taille LG', role: 'Utilisateur', size: 'lg', variant: 'bordered' } %}
{# ===== SOUS-TITRE PERSONNALISÉ ===== #}

Sous-titre personnalisé

Paramètre : subtitle — Texte libre sous le nom

{% verbatim %}{% include '_molecules/user-card/user-card.html.twig' with {
    name: 'Jean Dupont',
    subtitle: 'Membre depuis janvier 2024',
    variant: 'bordered'
} %}{% endverbatim %}
{% include '_molecules/user-card/user-card.html.twig' with { name: 'Marie Martin', subtitle: 'Dernière connexion il y a 2h', variant: 'bordered' } %} {% include '_molecules/user-card/user-card.html.twig' with { name: 'Pierre Durand', subtitle: '12 cours créés ce mois', badge: { text: 'Actif', variant: 'success' }, variant: 'bordered' } %}
{# ===== AVEC CONTRÔLES CUSTOM ===== #}

Avec contrôles custom

Block : {% verbatim %}{% block controls %}{% endverbatim %} — Via embed

{% verbatim %}{% embed '_molecules/user-card/user-card.html.twig' with {
    name: 'Jean Dupont',
    subtitle: 'Solde : 250 000 tokens',
    variant: 'bordered'
} %}
    {% block controls %}
        {# Slider + Input custom #}
    {% endblock %}
{% endembed %}{% endverbatim %}
{# Exemple avec slider de tokens (design production) #}

Exemple : Allocation de tokens par membre (interactif)

{# Membre 1 #}
BT
Beta Tester Solde : 250 000 tokens
{% include '_molecules/member-slider/member-slider.html.twig' with { value: 119047, min: 0, max: 500000, step: 1000, unit: 'tokens/mois' } %}
{# Membre 2 #}
ML
Marie Laurent Solde : 50 000 tokens
{% include '_molecules/member-slider/member-slider.html.twig' with { value: 75000, min: 0, max: 500000, step: 1000, unit: 'tokens/mois' } %}
{# Exemple simple avec toggle #}

Exemple simple avec toggle

{% embed '_molecules/user-card/user-card.html.twig' with { name: 'Sophie Laurent', role: 'Designer', variant: 'bordered' } %} {% block controls %} {% endblock %} {% endembed %} {% embed '_molecules/user-card/user-card.html.twig' with { name: 'Marc Petit', role: 'Développeur', variant: 'bordered' } %} {% block controls %} {% endblock %} {% endembed %}

Le block controls permet d'injecter n'importe quel élément : toggles, sliders, inputs, boutons custom...

{# ===== PARAMÈTRES ===== #}

Paramètres

Paramètre Type Défaut Description
namestring(requis)Nom de l'utilisateur
emailstringnullAdresse email
rolestringnullRôle/fonction
subtitlestringnullSous-titre personnalisé
avatarstringnullURL de l'avatar
initialsstringautoInitiales (si pas d'avatar)
badgeobjectnull{text, variant, dot?}
progressnumbernullPourcentage pour progress ring
progressLabelstringnullLabel du progress
hrefstringnullRend la carte cliquable
actionsarraynullActions [{icon, label, onclick?}]
sizestringmdsm, md, lg
variantstringdefaultdefault, bordered, elevated
classstring''Classes CSS additionnelles
{% endblock %}