Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

Image

A component for displaying images.

View in Storybook (opens in a new tab)

Installation

import { Image } from "@ginga-ui/core";

Basic usage

A simple image example.

A beautiful mountain landscape
image.tsx
image.module.css
import { Image } from "@ginga-ui/core";
import styles from "./image.module.css";

export function BasicExample() {
  return (
    <Image
      src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4"
      alt="A beautiful mountain landscape"
      className={styles.basicImage}
    />
  );
}

Avatar

An example of an avatar image.

User avatarUser avatarUser avatar
image.tsx
image.module.css
import { Image } from "@ginga-ui/core";
import styles from "./image.module.css";

export function AvatarExample() {
  return (
    <div className={styles.avatars}>
      <Image
        src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde"
        alt="User avatar"
        variant="avatar"
        className={styles.avatarSmall}
      />
      <Image
        src="https://images.unsplash.com/photo-1494790108377-be9c29b29330"
        alt="User avatar"
        variant="avatar"
        className={styles.avatarMedium}
      />
      <Image
        src="https://images.unsplash.com/photo-1599566150163-29194dcaad36"
        alt="User avatar"
        variant="avatar"
        className={styles.avatarLarge}
      />
    </div>
  );
}

Sizes

Displays images in various sizes.

Small sizeMedium size
image.tsx
image.module.css
import { Image } from "@ginga-ui/core";
import styles from "./image.module.css";

export function SizesExample() {
  return (
    <div className={styles.sizes}>
      <Image
        src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4"
        alt="Small size"
        className={styles.smallImage}
      />
      <Image
        src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4"
        alt="Medium size"
        className={styles.mediumImage}
      />
    </div>
  );
}

Rounded corners

Displays an image with rounded corners.

Image with rounded corners
image.tsx
image.module.css
import { Image } from "@ginga-ui/core";
import styles from "./image.module.css";

export function RoundedExample() {
  return (
    <Image
      src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4"
      alt="Image with rounded corners"
      className={styles.roundedImage}
    />
  );
}

Props

Image

NameTypeDefaultDescription
altstring-Required. Alternative text. Pass "" for decorative images.
variant"default" | "avatar""default""avatar" crops the image into a circle.
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML img (opens in a new tab) element.