{% extends 'base.html.twig' %} {% block title %}Modal - Design System - Bubul{% endblock %} {% block body %}
Le Modal utilise {% verbatim %}{% embed %}{% endverbatim %},
tu peux donc injecter n'importe quel contenu HTML dans le body.
Parametre : variant - Configure automatiquement l'icone et les couleurs
{% verbatim %}{# Footer automatique avec actionLabel, actionIcon, cancelLabel #}
{% embed '_molecules/modal/modal.html.twig' with {
id: 'delete-modal',
title: 'Supprimer l element',
subtitle: 'Cette action est irreversible',
variant: 'danger',
actionLabel: 'Supprimer',
actionIcon: 'trash',
cancelLabel: 'Annuler'
} %}
{% block body %}...{% endblock %}
{# Pas besoin de block footer ! #}
{% endembed %}{% endverbatim %}
Le modal focus automatiquement le premier input a l'ouverture
Parametre : position: right | left - Panel lateral au lieu de modal centre
{% verbatim %}{% embed '_molecules/modal/modal.html.twig' with {
id: 'settings-panel',
title: 'Parametres',
icon: 'settings',
position: 'right',
size: 'md',
actionLabel: 'Enregistrer',
cancelLabel: 'Annuler'
} %}
{% block body %}
{# Contenu scrollable automatiquement #}
...
{% endblock %}
{% endembed %}{% endverbatim %}
Note : En mode side-panel, le body est automatiquement scrollable et prend toute la hauteur disponible. Le footer reste fixe en bas.
Parametre : size
| Parametre | Type | Defaut | Description |
|---|---|---|---|
id | string | (requis) | ID unique pour open/close |
title | string | null | Titre du modal |
subtitle | string | null | Sous-titre / description |
variant | string | null | info, success, warning, danger (configure icone/couleurs) |
icon | string | auto | Icone du header (auto si variant) |
iconColor | string | auto | Couleur de l'icone (auto si variant) |
size | string | md | sm, md, lg, xl, 2xl, full |
position | string | center | center, right, left (side-panel) |
closable | bool | true | Bouton fermeture X |
closeOnOverlay | bool | true | Fermer au clic sur overlay |
actionLabel | string | null | Footer auto - Texte bouton action |
actionIcon | string | null | Footer auto - Icone bouton action |
actionUrl | string | null | Footer auto - URL form (bouton type=submit) |
cancelLabel | string | null | Footer auto - Texte bouton annuler |
class | string | '' | Classes additionnelles |
// Ouvrir un modal
openModal('mon-modal-id');
// Fermer un modal
closeModal('mon-modal-id');
// Fermer avec la touche Escape (automatique)
Cette fonctionnalite vous permet de creer des cours automatiquement a partir de vos documents PDF.
Formats supportes : PDF, DOCX, TXT
{% endblock %} {% endembed %} {# Success - avec footer automatique #} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-success', title: 'Opération réussie', subtitle: 'Votre cours a été généré avec succès', variant: 'success', actionLabel: 'Voir le cours' } %} {% block body %}Le cours "Introduction à la programmation" est maintenant disponible dans votre espace.
12 sections créées - 45 pages générées
Il vous reste moins de 1000 tokens. Certaines fonctionnalites pourraient etre limitees.
920 / 1000 tokens utilises
Êtes-vous sûr de vouloir supprimer le cours "Introduction à la programmation" ?
Toutes les données associées seront définitivement perdues.
2 utilisateurs selectionnes
{% endblock %} {% block footer %} {% include '_atoms/button/button.html.twig' with { label: 'Annuler', variant: 'ghost', size: 'lg', class: 'mr-auto', attr: { onclick: "closeModal('demo-search')" } } only %} {% include '_atoms/button/button.html.twig' with { label: 'Ajouter (2)', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-search')" } } only %} {% endblock %} {% endembed %} {# Formulaire complet #} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-form-full', title: 'Nouvel utilisateur', subtitle: 'Ajoutez un utilisateur a votre organisation', icon: 'user-add', iconColor: 'primary', size: 'lg' } %} {% block body %} {% endblock %} {% block footer %} {% include '_atoms/button/button.html.twig' with { label: 'Annuler', variant: 'ghost', size: 'lg', class: 'mr-auto', attr: { onclick: "closeModal('demo-form-full')" } } only %} {% include '_atoms/button/button.html.twig' with { label: 'Creer l utilisateur', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-form-full')" } } only %} {% endblock %} {% endembed %} {# =================================================================== MODALS DE DEMO - TAILLES =================================================================== #} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-sm', title: 'Small Modal', size: 'sm' } %} {% block body %}Modal de petite taille (max-w-sm). Ideal pour les confirmations simples.
{% endblock %} {% block footer %}{% include '_atoms/button/button.html.twig' with { label: 'Fermer', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-sm')" } } only %}{% endblock %} {% endembed %} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-md', title: 'Medium Modal', size: 'md' } %} {% block body %}Modal de taille moyenne (max-w-md). Taille par defaut, convient a la plupart des cas.
{% endblock %} {% block footer %}{% include '_atoms/button/button.html.twig' with { label: 'Fermer', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-md')" } } only %}{% endblock %} {% endembed %} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-lg', title: 'Large Modal', size: 'lg' } %} {% block body %}Modal de grande taille (max-w-lg). Pour les formulaires avec plusieurs champs.
{% endblock %} {% block footer %}{% include '_atoms/button/button.html.twig' with { label: 'Fermer', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-lg')" } } only %}{% endblock %} {% endembed %} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-xl', title: 'Extra Large Modal', size: 'xl' } %} {% block body %}Modal extra large (max-w-xl). Pour les formulaires complexes ou affichage de donnees.
{% endblock %} {% block footer %}{% include '_atoms/button/button.html.twig' with { label: 'Fermer', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-xl')" } } only %}{% endblock %} {% endembed %} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-2xl', title: '2XL Modal', size: '2xl' } %} {% block body %}Modal 2XL (max-w-2xl). Pour les tableaux de donnees ou previews larges.
{% endblock %} {% block footer %}{% include '_atoms/button/button.html.twig' with { label: 'Fermer', variant: 'primary', size: 'lg', attr: { onclick: "closeModal('demo-2xl')" } } only %}{% endblock %} {% endembed %} {# =================================================================== MODALS DE DEMO - SIDE PANELS =================================================================== #} {# Panel Droite #} {% embed '_molecules/modal/modal.html.twig' with { id: 'demo-panel-right', title: 'Panel Droite', subtitle: 'Panel lateral ancre a droite', icon: 'settings', iconColor: 'primary', position: 'right', size: 'md', actionLabel: 'Enregistrer', cancelLabel: 'Annuler' } %} {% block body %}Ce panel est ancre a droite de l'ecran et prend toute la hauteur.
{% include '_molecules/form/form-field.html.twig' with { label: 'Nom du projet', name: 'project_name', placeholder: 'Mon projet...' } %} {% include '_molecules/form/form-field.html.twig' with { label: 'Description', name: 'description', type: 'textarea', rows: 4, placeholder: 'Description du projet...' } %}Ajoutez du contenu supplementaire visible en bas de l'activite.
{% include '_molecules/form/form-field.html.twig' with { label: 'Notes pour l apprenant', name: 'notes', type: 'textarea', rows: 3, placeholder: 'Conseils, ressources complementaires...' } %}