TBX Docs
ExercisesComponents

Image

Drop-in image with an optional "AI generated" badge

Image renders a normal <img>. Add isAi to mark the picture as AI-generated: a small badge appears in the bottom-right corner.

Without isAi it behaves exactly like <img>, so you can use it everywhere and switch the badge on per image.

Import

import { Image } from "@bside-tech/tbx-ui/components";

Example

A catA catA cat
src/book/01_Chapter/022/atoms.tsx
import { Image } from "@bside-tech/tbx-ui/components";
import cat from "./cat_ai.jpg";

export function AiImageAtom() {
  return <Image src={cat} alt="A cat" isAi className="w-[600px]" />;
}

Badge size

The badge scales with the rendered image: 12% of its shorter side, clamped between 10px and 60px. Large images get a readable badge; thumbnails get a small one.

Badge tone

The badge comes in two variants. Pick the one that contrasts with the bottom-right corner of your image:

  • aiBadgeTone="light" (default): for images with a light corner.
  • aiBadgeTone="dark": for images with a dark corner.

Props

All standard <img> props (src, alt, className, style, loading, ...) are passed through.

Prop

Type

Notes

  • With isAi, the image is wrapped in a <span class="tbx-image"> so the badge can be positioned over it. className and style go on that wrapper, and the inner <img> fills its width.
  • The badge artwork is inlined in the package, so no extra asset setup is needed.
  • Static imports used in atoms.tsx are preloaded with the page. See Atoms › Images.

On this page