{% extends 'base.html.twig' %} {% block title %}Tabs - Design System - Bubul{% endblock %} {% block body %}
{% verbatim %}{% include '_molecules/tabs/tabs.html.twig' with {
id: 'my-tabs',
tabs: [
{ id: 'general', label: 'Général', icon: 'settings' },
{ id: 'security', label: 'Sécurité', icon: 'shield' },
{ id: 'notifications', label: 'Notifications', icon: 'bell', badge: '3' }
],
active: 'general'
} %}{% endverbatim %}
Fichier : templates/_molecules/tabs/tabs.html.twig
Contenu du premier onglet. Lorem ipsum dolor sit amet.
Contenu du deuxième onglet. Consectetur adipiscing elit.
Contenu du troisième onglet. Sed do eiusmod tempor.
12 nouveaux messages dans votre boîte de réception.
Messages envoyés récemment.
3 brouillons en attente.
Corbeille vide.
Paramètre : variant
Default (underline border)
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-default', tabs: [ { id: 'overview', label: 'Aperçu' }, { id: 'analytics', label: 'Analytiques' }, { id: 'reports', label: 'Rapports' } ], variant: 'default', active: 'overview' } %}Pills
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-pills', tabs: [ { id: 'overview', label: 'Aperçu' }, { id: 'analytics', label: 'Analytiques' }, { id: 'reports', label: 'Rapports' } ], variant: 'pills', active: 'overview' } %}Underline (sans bordure)
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-underline', tabs: [ { id: 'overview', label: 'Aperçu' }, { id: 'analytics', label: 'Analytiques' }, { id: 'reports', label: 'Rapports' } ], variant: 'underline', active: 'overview' } %}Settings (style page paramètres)
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-settings', tabs: [ { id: 'account', label: 'Compte', icon: 'user' }, { id: 'moodia', label: 'Moodia', icon: 'book' }, { id: 'serenia', label: 'Serenia', icon: 'chat' }, { id: 'developer', label: 'Développeur', icon: 'settings', right: true }, { id: 'slidia', label: 'Slidia', icon: 'presentation-graph' }, ], variant: 'settings', active: 'account' } %}Icônes en grayscale par défaut, colorées au hover/actif. Scale 1.1 au hover. Dernier tab aligné à droite avec right: true.
Paramètre : size
Small (sm)
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-sm', tabs: [ { id: 'all', label: 'Tous' }, { id: 'active', label: 'Actifs' }, { id: 'archived', label: 'Archivés' } ], size: 'sm', active: 'all' } %}Medium (md) - défaut
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-md', tabs: [ { id: 'all', label: 'Tous' }, { id: 'active', label: 'Actifs' }, { id: 'archived', label: 'Archivés' } ], size: 'md', active: 'all' } %}Large (lg)
{% include '_molecules/tabs/tabs.html.twig' with { id: 'demo-lg', tabs: [ { id: 'all', label: 'Tous' }, { id: 'active', label: 'Actifs' }, { id: 'archived', label: 'Archivés' } ], size: 'lg', active: 'all' } %}Paramètre : fullWidth: true
Paramètre par onglet : disabled: true
L'onglet "Entreprise" est désactivé (fonctionnalité non disponible).
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
tabs | array | (requis) | Liste des onglets |
tabs[].id | string | (requis) | Identifiant unique |
tabs[].label | string | (requis) | Texte de l'onglet |
tabs[].icon | string | null | Nom de l'icône |
tabs[].badge | string | null | Badge (compteur) |
tabs[].disabled | bool | false | Désactive l'onglet |
tabs[].right | bool | false | Aligne l'onglet à droite |
active | string | premier | ID de l'onglet actif |
variant | string | default | default, pills, underline, settings |
size | string | md | sm, md, lg |
fullWidth | bool | false | Onglets en pleine largeur |
id | string | auto | ID du conteneur |
class | string | '' | Classes additionnelles |
// Changer d'onglet programmatiquement
switchTab('my-tabs', 'settings');
// Écouter les changements d'onglet
document.getElementById('my-tabs').addEventListener('tabChange', (e) => {
console.log('Onglet actif:', e.detail.tabId);
});
Les panels avec data-tab-panel-for sont automatiquement masqués/affichés.