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

Input

Champs de saisie texte, email, password, textarea

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

Usage

Le composant Input est utilisé pour tous les champs de saisie : texte, email, mot de passe, textarea, etc. Il inclut le support des labels, hints, erreurs et icônes.

{% verbatim %}{# Input simple #}
{% include '_atoms/form/input.html.twig' with {
    label: 'Adresse email',
    type: 'email',
    placeholder: 'votre@email.com',
    required: true
} %}

{# Avec icône et hint #}
{% include '_atoms/form/input.html.twig' with {
    label: 'Recherche',
    icon: 'search',
    hint: 'Recherchez par nom ou email'
} %}{% endverbatim %}
Fichier : templates/_atoms/form/input.html.twig
{# ===== TYPES ===== #}

Types d'input

Paramètre : type

{% include '_atoms/form/input.html.twig' with { label: 'Texte', type: 'text', placeholder: 'Votre texte...' } %} {% include '_atoms/form/input.html.twig' with { label: 'Email', type: 'email', placeholder: 'votre@email.com' } %} {% include '_atoms/form/input.html.twig' with { label: 'Mot de passe', type: 'password', placeholder: '••••••••' } %} {% include '_atoms/form/input.html.twig' with { label: 'Nombre', type: 'number', placeholder: '0' } %} {% include '_atoms/form/input.html.twig' with { label: 'Téléphone', type: 'tel', placeholder: '+33 6 00 00 00 00' } %} {% include '_atoms/form/input.html.twig' with { label: 'URL', type: 'url', placeholder: 'https://...' } %}
{# ===== TAILLES ===== #}

Tailles

Paramètre : size

{% include '_atoms/form/input.html.twig' with { label: 'Small (sm)', size: 'sm', placeholder: 'Taille small' } %} {% include '_atoms/form/input.html.twig' with { label: 'Medium (md) - défaut', size: 'md', placeholder: 'Taille medium' } %} {% include '_atoms/form/input.html.twig' with { label: 'Large (lg)', size: 'lg', placeholder: 'Taille large' } %}
Taille Hauteur Font
sm32px14px
md40px16px
lg48px18px
{# ===== VARIANTES ===== #}

Variantes

Paramètre : variant

{% include '_atoms/form/input.html.twig' with { label: 'Default', variant: 'default', placeholder: 'Bordure visible' } %} {% include '_atoms/form/input.html.twig' with { label: 'Filled', variant: 'filled', placeholder: 'Fond gris' } %}
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
    label: 'Recherche',
    variant: 'filled',
    placeholder: 'Tapez pour rechercher...'
} %}{% endverbatim %}
{# ===== ICÔNES ===== #}

Avec icônes

Paramètres : icon, iconPosition

{% include '_atoms/form/input.html.twig' with { label: 'Recherche', icon: 'search', iconPosition: 'left', placeholder: 'Rechercher...' } %} {% include '_atoms/form/input.html.twig' with { label: 'Email', icon: 'mail', iconPosition: 'left', type: 'email', placeholder: 'votre@email.com' } %} {% include '_atoms/form/input.html.twig' with { label: 'Mot de passe', icon: 'lock', iconPosition: 'left', type: 'password', placeholder: '••••••••' } %} {% include '_atoms/form/input.html.twig' with { label: 'Lien', icon: 'link', iconPosition: 'right', type: 'url', placeholder: 'https://...' } %}
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
    label: 'Recherche',
    icon: 'search',
    iconPosition: 'left',
    placeholder: 'Rechercher...'
} %}{% endverbatim %}
{# ===== ÉTATS ===== #}

États

{% include '_atoms/form/input.html.twig' with { label: 'Champ normal', placeholder: 'Entrez du texte...' } %} {% include '_atoms/form/input.html.twig' with { label: 'Avec hint', placeholder: 'Entrez du texte...', hint: 'Ce texte aide l\'utilisateur à comprendre le champ' } %} {% include '_atoms/form/input.html.twig' with { label: 'Obligatoire', placeholder: 'Entrez du texte...', required: true } %} {% include '_atoms/form/input.html.twig' with { label: 'Avec erreur', placeholder: 'Entrez du texte...', error: 'Ce champ est obligatoire' } %} {% include '_atoms/form/input.html.twig' with { label: 'Désactivé', placeholder: 'Non modifiable', disabled: true, value: 'Valeur fixe' } %} {% include '_atoms/form/input.html.twig' with { label: 'Lecture seule', placeholder: 'Non modifiable', readonly: true, value: 'Valeur en lecture seule' } %}
{# ===== TEXTAREA ===== #}

Textarea

Paramètres : type: 'textarea', rows

{% include '_atoms/form/input.html.twig' with { type: 'textarea', label: 'Description', placeholder: 'Décrivez votre projet...', rows: 4 } %} {% include '_atoms/form/input.html.twig' with { type: 'textarea', label: 'Commentaires (6 lignes)', placeholder: 'Vos commentaires...', rows: 6, hint: 'Maximum 500 caractères' } %}
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
    type: 'textarea',
    label: 'Description',
    placeholder: 'Décrivez votre projet...',
    rows: 6
} %}{% endverbatim %}
{# ===== EXEMPLE FORMULAIRE ===== #}

Exemple de formulaire

{% include '_atoms/form/input.html.twig' with { label: 'Nom complet', type: 'text', placeholder: 'Jean Dupont', required: true, icon: 'user' } %} {% include '_atoms/form/input.html.twig' with { label: 'Email', type: 'email', placeholder: 'jean@exemple.com', required: true, icon: 'mail' } %} {% include '_atoms/form/input.html.twig' with { label: 'Mot de passe', type: 'password', placeholder: '••••••••', required: true, icon: 'lock', hint: 'Minimum 8 caractères' } %} {% include '_atoms/form/input.html.twig' with { type: 'textarea', label: 'Message', placeholder: 'Votre message...', rows: 4 } %}
{% include '_atoms/button/button.html.twig' with { label: 'Envoyer', variant: 'primary', type: 'submit', icon: 'arrow-right', iconPosition: 'right' } %}
{# ===== PARAMÈTRES ===== #}

Référence des paramètres

Paramètre Type Défaut Options
type string 'text' text, email, password, number, tel, url, search, textarea
label string null Texte du label
placeholder string '' Texte placeholder
size string 'md' sm, md, lg
variant string 'default' default, filled
icon string null Nom de l'icône
iconPosition string 'left' left, right
required bool false Champ obligatoire
disabled bool false Champ désactivé
error string null Message d'erreur
hint string null Texte d'aide
rows number 4 Lignes pour textarea
{% endblock %}