useImage API
Tracks image loading state as a reactive state machine with idle, loading, loaded, and error states.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| useImage | System |
| useIntersectionObserver | System |
| useLazy | System |
| Image | Semantic |
| Avatar | Semantic |
Functions
useImage
(options: UseImageOptions) => UseImageReturnTracks image loading state as a reactive state machine.
Options
eager
MaybeRefOrGetter<boolean> | undefinedWhether the image should load. When false, status stays idle and
source resolves to undefined so the browser does not start loading.
Default: true
Properties
isIdle
Readonly<Ref<boolean, boolean>>Whether the image has not yet started loading (eager is false).
source
Readonly<Ref<string | undefined, string | undefined>>Gated source URL. Resolves to undefined while idle, otherwise the
current src value. Bind directly to the <img> src attribute.