Boutons

Documentation du tag

Returns a button item. Takes a dict as parameter, with the following structure:

data_dict = {
    "label": "Label of the button item",
    "onclick": "button action",
    "type": "(Optional) type of button (submit or button - default: submit),
    "name": "(Optional) name of the button",
    "is_disabled": "(Optional) boolean that indicate if the button is activated
    (default: False)",
    "extra_classes": "(Optional) string with names of extra classes."
}

All of the keys of the dict can be passed directly as named parameters of the tag.

Relevant extra_classes:

  • village-btn--secondary: secundary button
  • village-btn--tertiary: tertiary button
  • village-btn--tertiary-no-outline: tertiary button with no outline
  • village-btn--icon-left and village-btn--icon-right: add an icon to the button (associated with an icon class)
  • village-btn--sm and village-btn--lg: button smaller or larger than the default size

Tag name: village_button

Usage: {% village_button data_dict %}

Exemples

Données

{'label': 'Bouton principal',
 'onclick': "alert('Vous avez cliqué sur le bouton principal')"}

Résultat

Données

{'extra_classes': 'village-btn--secondary',
 'label': 'Bouton secondaire',
 'name': 'secundary-button',
 'onclick': "alert('Vous avez cliqué sur le bouton secondaire')",
 'type': 'button'}

Résultat

Données

{'extra_classes': 'village-btn--tertiary',
 'label': 'Bouton tertiaire',
 'onclick': "alert('Vous avez cliqué sur le bouton tertiaire')"}

Résultat

Données

{'extra_classes': 'village-btn--tertiary-no-outline',
 'label': 'Bouton tertiaire sans bordure',
 'onclick': "alert('Vous avez cliqué sur le bouton tertiaire sans bordure')",
 'type': 'button'}

Résultat