Skip to content
Postkit

Figure. Images that load fast, read well and credit the source.

  • Media
  • Static
  • Stability · Initial
  • ::postkit-figure
Abstract Postkit editorial artwork
A portable story can retain its meaning across renderers.Postkit

Usage. An image, what it shows, and who made it.

<Figure
  src="/component-preview.svg"
  alt="Abstract Postkit editorial artwork"
  caption="A portable story can retain its meaning across renderers."
  credit="Postkit"
  aspectRatio="16 / 9"
/>

Give width and height and the page reserves the space before the image loads. Several related images read better as a Gallery.

Props. Always in step with the code.

PropTypeDefaultDescription
srcRequiredstringNoneThe image URL.
altRequiredstringNoneAlternative text, or an explicitly empty value for a decorative image.
captionstringNoneVisible supporting text below the image.
creditstringNoneThe image attribution or credit.
creditHrefstringNoneA URL for the image attribution.
hrefstringNoneAn optional destination when the image is activated.
widthnumberNoneThe intrinsic image width in pixels.
heightnumberNoneThe intrinsic image height in pixels.
aspectRatiostringNoneA CSS aspect ratio such as 16 / 9.
objectFit"contain" | "cover""cover"How the image fits its media frame.
objectPositionstringNoneThe focal position within the media frame.
loading"eager" | "lazy""lazy"Browser image loading behavior.
sizesstringNoneResponsive image display-size hints.
srcSetstringNoneResponsive image source candidates.
layout"inline" | "wide" | "bleed""inline"The figure width relative to article content.
Appearance
size"sm" | "md" | "lg""md"The component density and type scale.
variant"outline" | "subtle" | "plain""subtle"The component visual treatment.

Every component also takes unstyled and the part-styling props. Change a default for your whole site with defaults in createPostkit. Part styles

Anatomy. Every part is yours to restyle.

Each layer is one data-postkit-part, outlined where it sits. Point at a label to isolate its layer, or assemble it back into the component.

Every part

  • root <figure>
  • mediaLink
  • media <div>
  • image <img>
  • figcaption
  • caption <span>
  • credit <span>
  • creditLink
  • number

Renderers. One component, everywhere you publish.

  • Headless @postkit/reactSupported
  • Chakra @postkit/chakraSupported
  • Email @postkit/emailSupported
  • Astro @postkit/astroStatic
  • Web components @postkit/elementsPlanned

Accessibility. Every image says what it shows, or that it's decoration.

  • alt is required. Pass alt="" for a decorative image, and the build accepts it on purpose.
  • The caption and credit sit in figcaption, so they're tied to the image.
  • With href set, the whole image is one link, named by its alt text.
Edit this page on GitHubNext · Gallery ›
Postkit

Richer posts, written once, right everywhere.

© 2026 Postkit. MIT licensed.
LicensingPrivacy