{% extends 'base.html.twig' %} {% block title %}Checkbox - Design System - Bubul{% endblock %} {% block body %}
Le composant Checkbox permet de créer des cases à cocher accessibles et personnalisées. Il supporte les labels, hints, erreurs et plusieurs tailles.
{% verbatim %}{# Checkbox simple #}
{% include '_atoms/form/checkbox.html.twig' with {
label: 'Se souvenir de moi',
name: 'remember_me'
} %}
{# Avec hint #}
{% include '_atoms/form/checkbox.html.twig' with {
label: 'Recevoir la newsletter',
hint: 'Un email par semaine maximum',
checked: true
} %}{% endverbatim %}
templates/_atoms/form/checkbox.html.twig
Paramètre : size
| Taille | Checkbox | Label |
|---|---|---|
sm | 16px | 14px |
md | 20px | 16px |
lg | 24px | 18px |
Paramètre : variant
{% verbatim %}{% include '_atoms/form/checkbox.html.twig' with {
label: 'Option premium',
variant: 'card',
hint: 'Accès à toutes les fonctionnalités'
} %}{% endverbatim %}
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
label |
string | null |
Texte du label |
checked |
bool | false |
État coché |
name |
string | null |
Attribut name |
value |
string | '1' |
Valeur quand coché |
size |
string | 'md' |
sm, md, lg |
variant |
string | 'default' |
default, card |
disabled |
bool | false |
Désactivé |
required |
bool | false |
Obligatoire |
error |
string | null |
Message d'erreur |
hint |
string | null |
Texte d'aide |