{% extends 'base.html.twig' %} {% block title %}Input - Design System - Bubul{% endblock %} {% block body %}
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 %}
templates/_atoms/form/input.html.twig
Paramètre : type
Paramètre : size
| Taille | Hauteur | Font |
|---|---|---|
sm | 32px | 14px |
md | 40px | 16px |
lg | 48px | 18px |
Paramètre : variant
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
label: 'Recherche',
variant: 'filled',
placeholder: 'Tapez pour rechercher...'
} %}{% endverbatim %}
Paramètres : icon, iconPosition
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
label: 'Recherche',
icon: 'search',
iconPosition: 'left',
placeholder: 'Rechercher...'
} %}{% endverbatim %}
Paramètres : type: 'textarea', rows
{% verbatim %}{% include '_atoms/form/input.html.twig' with {
type: 'textarea',
label: 'Description',
placeholder: 'Décrivez votre projet...',
rows: 6
} %}{% endverbatim %}
| 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 |