Navigated to /docs/ui/components/image

Image

Image primitive with skeleton and fallback support.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { Image } from "@tavojs/ui/image";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/image.

When to use

Use it when

Use `Image` for responsive image surfaces

Choose something else when

Avoid Image when replacing interactive controls with content-only components.

Examples

Image example

TSX
tsximport { Image } from "@tavojs/ui/image";

export function ImageExample1() {
  return (
    <>
      <Image src="/preview.png" alt="Dashboard preview" width="100%" height={320} objectFit="cover" />
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
srcstring

Configures src for this component.
altstring

Configures alt for this component.
widthnumber | string

Configures width for this component.
heightnumber | string

Configures height for this component.
objectFit"cover" | "contain" | "fill" | "none" | "scale-down"

Configures objectFit for this component.
skeleton"text" | "circular" | "rectangular" | "rounded"

Configures skeleton for this component.
fallbackstring

Configures fallback for this component.
widthsnumber[]

Configures widths for this component.

Complete TypeScript API

Import from @tavojs/ui/image. Published exports: Image, ImageProps.

ImageProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Image.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Image.

idstring

No

Inherited id attribute accepted by Image.

rolestring

No

Inherited role attribute accepted by Image.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Image.

titlestring

No

Inherited title attribute accepted by Image.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Image.

hiddenboolean

No

Inherited hidden attribute accepted by Image.

disabledboolean

No

Inherited disabled attribute accepted by Image.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Image.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Image.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Image.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Image.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Image.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Image.

srcstring

No

Configures src for this component.

altstring

No

Configures alt for this component.

widthstring | number

No

Configures width for this component.

heightstring | number

No

Configures height for this component.

objectFit"none" | "cover" | "contain" | "fill" | "scale-down"

No

Configures objectFit for this component.

skeleton"text" | "circular" | "rectangular" | "rounded"

No

Configures skeleton for this component.

fallbackstring

No

Configures fallback for this component.

State ownership and DOM target

ConcernContract
StateNo component state contract is exposed; the application owns the rendered content and surrounding behavior.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Avoid Image when replacing interactive controls with content-only components.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Content components should keep meaningful text and media alternatives available to assistive technology.

  • Provide alt text for meaningful images.

  • Use semantic text variants for headings and paragraphs.

  • Do not hide essential content visually unless VisuallyHidden is intentional.

Component status

ContractCurrent value
Maturitystable
Categorycontent
Component import@tavojs/ui/image
Explicit CSS import@tavojs/ui/css/image
PreviewInteractive preview available on this page