Image

Encapsule <img> avec les garanties qu'il n'impose pas par défaut : espace réservé (anti-CLS), lazy loading, support WebP, états de chargement et d'erreur. Wraps <img> with the guarantees it doesn't enforce by default: reserved space (anti-CLS), lazy loading, WebP support, loading and error states.

DémonstrationDemo

Par défaut — lazy, sans skeletonDefault — lazy, no skeleton
object-fit: cover / containobject-fit: cover / contain
État d'erreur — repli si l'image échoueError state — fallback on failed load

Règles absoluesAbsolute rules

Tokens de composantComponent tokens

Token CSSRéférenceReferenceValeurValue
--agtc-component-image-skeleton-backgroundsemantic.color.background.subtle#f0f0f0
--agtc-component-image-skeleton-background-pulsesemantic.color.background.hover#fafafa
--agtc-component-image-fallback-backgroundsemantic.color.background.subtle#f0f0f0
--agtc-component-image-fallback-iconsemantic.color.text.secondary#646464
--agtc-component-image-fallback-textsemantic.color.text.secondary#646464

AccessibilitéAccessibility

ImplémentationImplementation

<!-- De base — width/height obligatoiresBasic — width/height required -->
<agtc-image src="photo.jpg" alt="…" width="800" height="450"></agtc-image>

<!-- WebP avec repliwith fallback -->
<agtc-image src="photo.jpg" src-webp="photo.webp" alt="…" width="800" height="450"></agtc-image>

<!-- Skeleton en option (images lourdes/hero)Opt-in skeleton (heavy/hero images) -->
<agtc-image src="hero.jpg" alt="…" width="1200" height="630" skeleton></agtc-image>

<!-- LCP -->
<agtc-image src="hero.jpg" alt="…" width="1200" height="630" priority></agtc-image>

DOs et DON'TsDOs and DON'Ts

À faireDo

  • Toujours fournir width et heightAlways provide width and height
  • Réserver priority à la véritable image LCPReserve priority for the true LCP image
  • Utiliser skeleton pour les images lourdes/hero seulementUse skeleton for heavy/hero images only

À éviterDon't

  • Omettre width/heightOmitting width/height
  • decorative sur une image porteuse de sensdecorative on a meaningful image
  • priority sur plus d'une image par pagepriority on more than one image per page

UX Patterns Reference

Patterns approved via the ux-pattern-review workflow (ADR-036). Decision: all approved, skeleton explicitly requested for v1.

PatternSourceAppliedJustification
Decorative vs meaningful image distinctionWCAG 1.1.1 / NN/g✅Mirrors the pattern already approved on agtc-icon — decorative prop → alt="" + aria-hidden
Skeleton screen while loading (opt-in)NN/g — Skeleton Screens 101✅Included in v1 per explicit human decision (2026-07-21) — opt-in via skeleton, not on by default, since it's overkill for small inline images
Graceful fallback on load failureGeneral error-handling principle (no dedicated reference-source article found for images specifically)✅Icon + visible alt text instead of a broken-image hole
object-fit configurableDesign system decision (not a reference-source pattern)✅fit prop, default cover — consistent cropping across avatar/illustration usages
Contribuer à ce projet Contribute to this project

Ce système est ouvert aux contributions — tokens, composants, décisions architecturales, corrections d'accessibilité ou documentation. Toute amélioration est bienvenue. This system welcomes contributions — tokens, components, architectural decisions, accessibility fixes, or documentation. Every improvement counts.

Voir sur GitHub View on GitHub