Tuile
- Voir la page de documentation du composant sur le Système de Design de l’État Ouvre une nouvelle fenêtre
- Voir la page d’exemple du Système de Design de l’État Ouvre une nouvelle fenêtre
Documentation du tag
Returns a tile item. Takes a dict as parameter, with the following structure:
data_dict = {
"title": "Title of the tile item",
"url": "URL of the link of the tile item",
"image_path": "path of the tile image",
"svg_path": "path of the tile image if this is a SVG",
"description": "(Optional) description of the tile item",
"detail": "(Optional) detail zone of the tile tiem
"top_detail": "(Optional) dict with a top detail content and optional tags or badges",
"heading_tag": "(Optional) Heading tag for the alert title (default: h3)",
"id": "(Optional) id of the tile item",
"enlarge_link": "(Optional) boolean. If true (default), the link covers the whole card",
"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-tile--sm
: for a small (SM) tilevillage-tile--horizontal
: for an horizontal tilevillage-tile--download
: Replaces the forward arrow icon with a download onevillage-tile--grey
: adds a grey background on the tilevillage-tile--no-border
: removes the tile bordervillage-tile--no-background
: removes the tile backgroundvillage-tile--shadow
: adds a shadow to the tile border
Format of the top_detail dict (every field is optional):
top_detail = {
"tags": "a list of tag items (mutually exclusive with badges)",
"badges": "a list of badge items (mutually exclusive with tags)"
}
Note: image_path
will work even if a SVG is provided, but svg_path
will use a
<svg>
html tag instead of the <img>
tag.
Tag name: village_tile
Usage:
{% village_tile data_dict %}
Exemples
Données
{'image_path': '/static/img/placeholder.1x1.svg', 'title': 'Tuile basique (verticale, MD)', 'url': '/'}
Résultat
Données
{'description': 'Tuile horizontale (MD)', 'detail': 'Avec un pictogramme SVG', 'extra_classes': 'village-tile--horizontal', 'id': 'tile-cityhall', 'svg_path': '/static/django_village/dist/artwork/pictograms/buildings/city-hall.svg', 'title': 'Tuile horizontale', 'url': '/'}
Résultat
Données
{'extra_classes': 'village-tile--sm', 'id': 'tile-nuclear-plant', 'svg_path': '/static/django_village/dist/artwork/pictograms/buildings/nuclear-plant.svg', 'title': 'Tuile verticale (SM)', 'url': '/'}
Résultat
Données
{'extra_classes': 'village-tile--horizontal village-tile--sm', 'id': 'tile-map', 'svg_path': '/static/django_village/dist/artwork/pictograms/map/map.svg', 'title': 'Tuile horizontale (SM)', 'top_detail': {'badges': [{'extra_classes': 'village-badge--sm ' 'village-badge--purple-glycine', 'label': 'Badge coloré'}]}, 'url': '/'}
Résultat
Tuile horizontale (SM)
-
Badge coloré
Données
{'extra_classes': 'village-tile--horizontal village-tile--grey ' 'village-tile--shadow village-tile--no-border', 'id': 'tile-map', 'svg_path': '/static/django_village/dist/artwork/pictograms/leisure/paint.svg', 'title': 'Tuile à fond gris et ombre sans bordure', 'url': '/'}
Résultat
Données
{'detail': 'PDF — 1,7 Mo', 'extra_classes': 'village-tile--horizontal village-tile--download', 'svg_path': '/static/django_village/dist/artwork/pictograms/document/document-signature.svg', 'title': 'Tuile de téléchargement', 'url': '/'}
Résultat
Tuile de téléchargement
PDF — 1,7 Mo