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

Toggle

Interrupteurs on/off

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

Usage

{% verbatim %}{% include '_atoms/form/toggle.html.twig' with {
    label: 'Notifications',
    name: 'notifications',
    checked: true,
    hint: 'Recevoir les alertes par email'
} %}{% endverbatim %}

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

{# ===== EXEMPLES DE BASE ===== #}

Exemples

{% include '_atoms/form/toggle.html.twig' with { label: 'Mode sombre' } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Notifications push', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Newsletter', hint: 'Un email par semaine maximum', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Données analytiques', hint: 'Aide à améliorer l\'application' } %}
{# ===== VARIANTES DE COULEUR ===== #}

Variantes de couleur

Paramètre : variant

{% include '_atoms/form/toggle.html.twig' with { label: 'Primary (défaut)', variant: 'primary', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Success', variant: 'success', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Warning', variant: 'warning', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Error', variant: 'error', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Cohorts', variant: 'cohorts', checked: true } %}
{# ===== TAILLES ===== #}

Tailles

{% include '_atoms/form/toggle.html.twig' with { label: 'Small (sm)', size: 'sm', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Medium (md) - défaut', size: 'md', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Large (lg)', size: 'lg', checked: true } %}
{# ===== POSITION DU LABEL ===== #}

Position du label

{% include '_atoms/form/toggle.html.twig' with { label: 'Label à droite (défaut)', labelPosition: 'right', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Label à gauche', labelPosition: 'left', checked: true } %}
{# ===== ÉTATS ===== #}

États

{% include '_atoms/form/toggle.html.twig' with { label: 'Désactivé (off)' } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Activé (on)', checked: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Disabled off', disabled: true } %} {% include '_atoms/form/toggle.html.twig' with { label: 'Disabled on', disabled: true, checked: true } %}
{# ===== EXEMPLE SETTINGS ===== #}

Exemple : Page de paramètres

{% include '_atoms/form/toggle.html.twig' with { label: 'Compte actif', hint: 'Désactiver pour suspendre temporairement le compte', variant: 'success', checked: true } %}
{% include '_atoms/form/toggle.html.twig' with { label: 'Authentification à deux facteurs', hint: 'Renforce la sécurité de votre compte', checked: true } %}
{% include '_atoms/form/toggle.html.twig' with { label: 'Emails marketing', hint: 'Recevoir nos offres et actualités' } %}
{% include '_atoms/form/toggle.html.twig' with { label: 'Mode développeur', hint: 'Accès aux outils avancés', variant: 'warning' } %}
{# ===== PARAMÈTRES ===== #}

Paramètres

Paramètre Type Description
labelstringTexte du label
checkedboolÉtat activé
variantstringprimary, success, warning, error, cohorts
sizestringsm, md, lg
labelPositionstringleft, right
hintstringTexte d'aide
disabledboolDésactivé
{% endblock %}