Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Image

image

Loads images with fade-in, fallback, radius, and optional hover zoom.

Usage

Basic usage

Input src/alt and width/height fixed shell size, fade in after loading is completed.

Landscape
tsx
<Image src="/photo.jpg" alt="Landscape" width={200} height={130} />

Rounded corners

radius provides none / sm / md / lg / full five-level scale.

LandscapeLandscapeAvatar
tsx
<>
  <Image src="/photo.jpg" alt="Landscape" width={120} height={90} radius="sm" />
  <Image src="/photo.jpg" alt="Landscape" width={120} height={90} radius="lg" />
  <Image src="/avatar.jpg" alt="Avatar" width={90} height={90} radius="full" />
</>

hover Zoom (isZoomed)

isZoomed, the casing is cropped and overflows. Move the mouse over the picture to enlarge it.

Landscape
tsx
<Image src="/photo.jpg" alt="Landscape" width={200} height={130} isZoomed />

Loading failure and rollback

When the original image fails to load, it switches to fallbackSrc; if the rollback also fails, the placeholder bottom is displayed.

Fallback
tsx
<Image
  src="https://invalid.example/none.png"
  fallbackSrc="/photo.jpg"
  alt="Fallback"
  width={200}
  height={130}
/>

When to use

Use Image instead of a raw <img> when a cover, avatar, or content image needs fade-in, failure fallback, radius, or hover zoom. Use Marquee for a decorative logo wall, or ImageViewer for fullscreen zoom.

Import

ts
import { Image, imageVariants } from "@hulianui/ui"

Props

Inherits Omit<ImgHTMLAttributes<HTMLImageElement>, "width" | "height">.

NameTypeDefaultDescription
src *string-Image URL.
altstring""Alternative text; empty by default, so provide meaningful text unless the image is decorative.
widthnumber | string-Numeric width or CSS length.
heightnumber | string-Numeric height or CSS length.
radius"none"|"sm"|"md"|"lg"|"full""md"Radius scale.
isZoomedbooleanfalseScales on hover within the clipped wrapper.
fallbackSrcstring-Failure fallback URL; omission shows the placeholder surface.
previewboolean | ImagePreviewConfigfalseEnables built-in click-to-preview via ImageViewer with keyboard focus support; accepts true or { src?, images?, index?, caption?, label?, lens? }.
classNamestring-Wrapper class controlling dimensions and clipping.
imgClassNamestring-Inner <img> class.
...imgOmit\<ImgHTMLAttributes, "width"|"height"\>-Remaining native image props.

Usage notes

  • Hover zoom relies on wrapper clipping and dimensions; do not move overflow control to imgClassName.
  • radius styles the wrapper. Combine radius="full" with equal dimensions for an avatar.
  • Consumer onLoad and onError are merged with internal fade and fallback behavior. This fixes issue #55.
  • The forwarded ref targets the inner <img> for natural dimensions or intersection logic, matching Input.
  • Candidate image-related skills describe application workflows rather than this component and are intentionally not linked.

Related

Table · Book3D · ProTable · PricingTable · JsonViewer · EditableTable

Playground

Landscape
<Image
  src="/photo.jpg"
  alt="Landscape"
  width={220}
  height={140}
/>
PreviousBentoGridData DisplayNextMagicCard

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Usage notes
    • Related
  • Playground