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

Button

Bouton d'action paramétrable

{# ===== NAVIGATION RAPIDE ===== #} {# ===== USAGE ===== #}

Usage

Le composant Button est utilisé pour les actions principales et secondaires de l'interface. Il est 100% paramétrable via les attributs Twig.

{% verbatim %}{# Utilisation basique #}
{% include '_atoms/button/button.html.twig' with {
    label: 'Mon bouton'
} %}

{# Avec options #}
{% include '_atoms/button/button.html.twig' with {
    label: 'Enregistrer',
    variant: 'success',
    icon: 'check',
    size: 'lg'
} %}{% endverbatim %}
Fichier : templates/_atoms/button/button.html.twig
{# ===== VARIANTES ===== #}

Variantes

Paramètre : variant

{# Primary #}
{% include '_atoms/button/button.html.twig' with { label: 'Primary', variant: 'primary' } %}
variant: 'primary'
{# Secondary #}
{% include '_atoms/button/button.html.twig' with { label: 'Secondary', variant: 'secondary' } %}
variant: 'secondary'
{# Success #}
{% include '_atoms/button/button.html.twig' with { label: 'Success', variant: 'success' } %}
variant: 'success'
{# Error #}
{% include '_atoms/button/button.html.twig' with { label: 'Error', variant: 'error' } %}
variant: 'error'
{# Warning #}
{% include '_atoms/button/button.html.twig' with { label: 'Warning', variant: 'warning' } %}
variant: 'warning'
{# Dark #}
{% include '_atoms/button/button.html.twig' with { label: 'Dark', variant: 'dark' } %}
variant: 'dark'
{# Outline #}
{% include '_atoms/button/button.html.twig' with { label: 'Outline', variant: 'outline' } %}
variant: 'outline'
{# Outline Dark #}
{% include '_atoms/button/button.html.twig' with { label: 'Outline Dark', variant: 'outline-dark' } %}
variant: 'outline-dark'
{# Ghost #}
{% include '_atoms/button/button.html.twig' with { label: 'Ghost', variant: 'ghost' } %}
variant: 'ghost'
{# Link #}
{% include '_atoms/button/button.html.twig' with { label: 'Link', variant: 'link' } %}
variant: 'link'
{# Variantes Soft (pour tableaux) #}

Variantes "Soft" (actions dans tableaux)

Boutons avec fond léger, idéaux pour les colonnes d'actions.

{# Soft Primary #}
{% include '_atoms/button/button.html.twig' with { label: 'Voir', icon: 'eye', variant: 'soft-primary', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'eye', iconOnly: true, variant: 'soft-primary', size: 'sm' } %}
variant: 'soft-primary'
{# Soft Success #}
{% include '_atoms/button/button.html.twig' with { label: 'Valider', icon: 'check', variant: 'soft-success', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'check', iconOnly: true, variant: 'soft-success', size: 'sm' } %}
variant: 'soft-success'
{# Soft Warning #}
{% include '_atoms/button/button.html.twig' with { label: 'Éditer', icon: 'edit', variant: 'soft-warning', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'edit', iconOnly: true, variant: 'soft-warning', size: 'sm' } %}
variant: 'soft-warning'
{# Soft Error #}
{% include '_atoms/button/button.html.twig' with { label: 'Supprimer', icon: 'trash', variant: 'soft-error', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'trash', iconOnly: true, variant: 'soft-error', size: 'sm' } %}
variant: 'soft-error'
{# Exemple tableau #}

Exemple : colonne Actions

Nom Email Actions
Jean Dupont jean@example.com
{% include '_atoms/button/button.html.twig' with { icon: 'eye', iconOnly: true, variant: 'soft-primary', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'edit', iconOnly: true, variant: 'soft-warning', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'trash', iconOnly: true, variant: 'soft-error', size: 'sm' } %}
Marie Martin marie@example.com
{% include '_atoms/button/button.html.twig' with { icon: 'eye', iconOnly: true, variant: 'soft-primary', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'edit', iconOnly: true, variant: 'soft-warning', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { icon: 'trash', iconOnly: true, variant: 'soft-error', size: 'sm' } %}
{# ===== TAILLES ===== #}

Tailles

Paramètre : size

{% include '_atoms/button/button.html.twig' with { label: 'XS', size: 'xs' } %} {% include '_atoms/button/button.html.twig' with { label: 'Small', size: 'sm' } %} {% include '_atoms/button/button.html.twig' with { label: 'Medium', size: 'md' } %} {% include '_atoms/button/button.html.twig' with { label: 'Large', size: 'lg' } %} {% include '_atoms/button/button.html.twig' with { label: 'Extra Large', size: 'xl' } %}
Taille Hauteur Padding Font
xs24px8px12px
sm32px16px14px
md40px24px16px
lg48px32px18px
xl56px40px20px
{# ===== RADIUS ===== #}

Border Radius

Paramètre : radius

{% include '_atoms/button/button.html.twig' with { label: 'None', radius: 'none' } %} {% include '_atoms/button/button.html.twig' with { label: 'Small', radius: 'sm' } %} {% include '_atoms/button/button.html.twig' with { label: 'Medium', radius: 'md' } %} {% include '_atoms/button/button.html.twig' with { label: 'Large', radius: 'lg' } %} {% include '_atoms/button/button.html.twig' with { label: 'XL', radius: 'xl' } %} {% include '_atoms/button/button.html.twig' with { label: 'Full (Pill)', radius: 'full' } %}
{# ===== ICÔNES ===== #}

Avec icônes

Paramètres : icon, iconPosition, iconOnly

{# Icône à gauche #}

Icône à gauche (défaut)

{% include '_atoms/button/button.html.twig' with { label: 'Ajouter', icon: 'plus' } %} {% include '_atoms/button/button.html.twig' with { label: 'Éditer', icon: 'edit', variant: 'secondary' } %} {% include '_atoms/button/button.html.twig' with { label: 'Valider', icon: 'check', variant: 'success' } %} {% include '_atoms/button/button.html.twig' with { label: 'Attention', icon: 'alert-triangle', variant: 'warning' } %} {% include '_atoms/button/button.html.twig' with { label: 'Supprimer', icon: 'trash', variant: 'error' } %}
{# Icône à droite #}

Icône à droite

{% include '_atoms/button/button.html.twig' with { label: 'Suivant', icon: 'chevron-right', iconPosition: 'right' } %} {% include '_atoms/button/button.html.twig' with { label: 'Télécharger', icon: 'download', iconPosition: 'right', variant: 'secondary' } %}
{# Icône seule #}

Icône seule

{% include '_atoms/button/button.html.twig' with { icon: 'plus', iconOnly: true } %} {% include '_atoms/button/button.html.twig' with { icon: 'edit', iconOnly: true, variant: 'secondary' } %} {% include '_atoms/button/button.html.twig' with { icon: 'check', iconOnly: true, variant: 'success' } %} {% include '_atoms/button/button.html.twig' with { icon: 'alert-triangle', iconOnly: true, variant: 'warning' } %} {% include '_atoms/button/button.html.twig' with { icon: 'trash', iconOnly: true, variant: 'error' } %} {% include '_atoms/button/button.html.twig' with { icon: 'x', iconOnly: true, variant: 'ghost' } %}

Icône seule (pill)

{% include '_atoms/button/button.html.twig' with { icon: 'plus', iconOnly: true, radius: 'full' } %} {% include '_atoms/button/button.html.twig' with { icon: 'edit', iconOnly: true, variant: 'secondary', radius: 'full' } %} {% include '_atoms/button/button.html.twig' with { icon: 'check', iconOnly: true, variant: 'success', radius: 'full' } %} {% include '_atoms/button/button.html.twig' with { icon: 'alert-triangle', iconOnly: true, variant: 'warning', radius: 'full' } %} {% include '_atoms/button/button.html.twig' with { icon: 'trash', iconOnly: true, variant: 'error', radius: 'full' } %} {% include '_atoms/button/button.html.twig' with { icon: 'x', iconOnly: true, variant: 'ghost', radius: 'full' } %}
{% verbatim %}{# Icône à gauche #}
{% include '_atoms/button/button.html.twig' with {
    label: 'Ajouter',
    icon: 'plus'
} %}

{# Icône à droite #}
{% include '_atoms/button/button.html.twig' with {
    label: 'Suivant',
    icon: 'chevron-right',
    iconPosition: 'right'
} %}

{# Icône seule #}
{% include '_atoms/button/button.html.twig' with {
    icon: 'trash',
    iconOnly: true,
    variant: 'ghost'
} %}{% endverbatim %}
{# ===== ÉTATS ===== #}

États

Paramètres : disabled, loading

{# Disabled #}

Désactivé

{% include '_atoms/button/button.html.twig' with { label: 'Primary', disabled: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Secondary', variant: 'secondary', disabled: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Success', variant: 'success', disabled: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Warning', variant: 'warning', disabled: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Error', variant: 'error', disabled: true } %}
{# Loading #}

Chargement

{% include '_atoms/button/button.html.twig' with { label: 'Enregistrement...', loading: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Envoi...', variant: 'success', loading: true } %} {% include '_atoms/button/button.html.twig' with { label: 'En cours...', variant: 'warning', loading: true } %} {% include '_atoms/button/button.html.twig' with { label: 'Suppression...', variant: 'error', loading: true } %}
{# ===== FULL WIDTH ===== #}

Full Width

Paramètre : width: 'full'

{% include '_atoms/button/button.html.twig' with { label: 'Se connecter', width: 'full' } %} {% include '_atoms/button/button.html.twig' with { label: 'Créer un compte', width: 'full', variant: 'secondary' } %}
{# ===== PARAMÈTRES ===== #}

Référence des paramètres

Paramètre Type Défaut Options
label string '' Texte du bouton
variant string 'primary' primary, secondary, success, error, warning, dark, outline, outline-dark, ghost, link
size string 'md' xs, sm, md, lg, xl
radius string 'lg' none, sm, md, lg, xl, full
width string 'auto' auto, full
type string 'button' button, submit, reset
href string null URL (rend un <a>)
target string null _blank, _self, etc.
icon string null Nom de l'icône (ex: 'check', 'plus')
iconPosition string 'left' left, right
iconOnly bool false true, false
loading bool false true, false
disabled bool false true, false
class string '' Classes Tailwind additionnelles
attr object {} Attributs HTML (data-*, aria-*, etc.)
{% endblock %}