Knit UI
GitHub

Playground

Loading playground…

Playground
<Image
  src="https://picsum.photos/seed/knitui/400/300"
  alt="Sample image"
  width={400}
  height={300}
  fit="cover"
/>

Examples

Fit Modes

All object-fit values side by side; each image is constrained to the same box.

Loading example…

Fit ModesSourceStorybook

Radius

Border-radius applied via a raw CSS value — from sharp to fully rounded.

Loading example…

RadiusSourceStorybook

Fallback

When the primary src is broken, the image automatically shows fallbackSrc.

Loading example…

FallbackSourceStorybook

No Source

No src and no fallbackSrc — demonstrates empty / missing image handling.

Loading example…

No SourceSourceStorybook

Banner

Wide aspect ratio constrained to a fixed height — useful for banners.

Loading example…

BannerSourceStorybook

Avatar

Square thumbnail with a circular radius — common for avatars.

Loading example…

AvatarSourceStorybook

Deprecated Source

Demonstrates the deprecated source prop still resolves correctly.

Loading example…

Deprecated SourceSourceStorybook

Transition

expo-image cross-fades the image in once it loads. transition accepts a duration in ms (shown) or a full ImageTransition object ({ duration, effect, timing }).

Loading example…

TransitionSourceStorybook

Placeholder

A blurhash placeholder is shown while the full image loads, avoiding layout shift and blank space. placeholder also accepts a thumbhash or a low-res source.

Loading example…

PlaceholderSourceStorybook

Blurred

blurRadius applies a native blur to the rendered image.

Loading example…

BlurredSourceStorybook

Object Position

objectPosition (expo-image's contentPosition) controls how the image is aligned within its frame when it overflows.

Loading example…

Object PositionSourceStorybook

Radius Tokens

radius accepts the theme radius tokens (xxs–xxl) in addition to raw CSS values. The image is clipped to the rounded frame on web and native alike.

Loading example…

Radius TokensSourceStorybook

Tinted

tintColor recolors the image — useful for monochrome icons/templates. It maps to expo-image's tintColor on native and an SVG color filter on web.

Loading example…

TintedSourceStorybook

Content Position Object

objectPosition (→ contentPosition) also accepts the object form with point/percent offsets from any edge.

Loading example…

Content Position ObjectSourceStorybook

Priorities

priority hints how urgently the image should load (low | normal | high). On web it sets fetchpriority on the underlying <img>.

Loading example…

PrioritiesSourceStorybook

Shadows

The inherited shadow elevation prop, from xs to xl.

Loading example…

ShadowsSourceStorybook

Styles

Per-slot styles targets individual parts — here the root frame and image.

Loading example…

StylesSourceStorybook

Showcase

A feature showcase: rounded, animated cross-fade in, with a blurhash placeholder, memory-disk caching, and a recycling key.

Loading example…

ShowcaseSourceStorybook

Props

PropTypeDefaultDescription
decoding"auto" | "async" | "sync" | undefined—The `<img decoding>` hint: `"async"` off the main thread, `"sync"` for the one hero. Web only.
disabled systemboolean | undefined——
fallbackPropsPartial<ImageProps> | undefined—Props spread onto the backing image (alias for `styles.image`).
fallbackSrcstring | undefined—URL shown when the primary source fails to load.
fetchPriority"auto" | "low" | "high" | undefined—The `<img fetchpriority>`, web only. Wins over `priority` there (which maps `"high"` / `"low"` to it too).
fitImageObjectFit | undefined
cover · contain · fill · none · scale-down
"cover"CSS object-fit value. Defaults to "cover".
loading"lazy" | "eager" | undefined—The `<img loading>`, web only. Default `"lazy"` (the browser fetches an image as it nears the viewport); `"eager"` for the one above-the-fold (LCP) image, with `fetchPriority="high"`.
onError((event: ImageErrorEvent) => void) | undefined——
onLoad((event: ImageLoadEvent) => void) | undefined——
radius systemstring | number | undefined—Border-radius — a theme token key or any valid CSS value.
resizeModeImageHostResizeMode | undefined—Deprecated — use fit instead.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined—Elevation from the shared shadow ladder (`"xs"`…`"xxl"`), as on `Box`.
sizesstring | undefined—The `<img sizes>` the browser picks a `srcSet` candidate by, web only.
sourceImageSrc | undefined—Deprecated — use src instead.
sourcesreadonly ImageWebSource[] | undefined—Format alternatives, web only: given (non-empty), the `<img>` is wrapped in a `<picture>` with one `<source>` per entry, in order, before it. The browser takes the first source whose `type` it decodes (and whose `media` matches); none does → the `<img>`'s own `src` / `srcSet`. So `sources={[{ type: "image/avif", srcSet: avif, sizes }]}` with a WebP `src` / `srcSet` downloads only the AVIF where it is supported and only the WebP elsewhere. The `<picture>` is `display: contents` (no box of its own), and the `<img>` stays the element that loads, errors and fills the box. Native ignores them: expo-image picks its own format.
srcImageSrc | undefinedhttps://picsum.photos/seed/knitui/400/300Image URL or require() result.
srcSetstring | undefined—The `<img srcset>` candidates (`"a.avif 256w, b.avif 512w"`), web only.
styles systemSlotStyles<ImageStyles> | undefined—Per-slot style sugar — props spread onto the matching part.
theme systemThemeName | null | undefined—Applies a theme to this element

Style slots

Every part of Image can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotTargets
fallbackProps for the error-state slot (Image.Fallback).
imageProps for the backing image element (Image.Image).
overlayProps for the always-on content slot layered over the image (Image.Overlay).
placeholderProps for the loading-state slot (Image.Placeholder).
rootProps for the relative-positioned Image.Root frame (parts layer over it).

Plus 828 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.

Edit this page on GitHub