Image Viewer

1.32.0Alpha

Image Viewer renders a static image preview and opens a full-screen viewer for pan, zoom, rotation, and flip interactions.

import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

Keyboard and Pointer Interactions

Focus the full-screen viewport to use keyboard interactions.

  • Arrow keys pan the image by nudgeStep, which defaults to 1 pixel.
  • Shift with an Arrow key uses nudgeStepShift, which defaults to 10 pixels.
  • Ctrl or Cmd with an Arrow key uses nudgeStepCtrl, which defaults to 50 pixels.
  • + or = zooms in.
  • - or _ zooms out.
  • The mouse wheel zooms around the pointer position.
  • Pinch gestures zoom and pan the image on touch devices.
  • Press Escape or click the backdrop to close the viewer.

Closing resets zoom, rotation, flip, and pan.

Examples

Simple

Use src and alt to render an image preview with the default popup, zoom, and reset controls.

<ImageViewer
  alt="Scenic view of a lake in the mountains"
  src="/images/nature-2.avif"
/>

Composite

Supply src and alt to <ImageViewer.Root>, then provide the composite parts to render the viewer.

import type {ReactElement} from "react"

import {ButtonGroup} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerCompositeDemo(): ReactElement {
  return (
    <ImageViewer.Root
      alt="Scenic view of a lake in the mountains"
      className="w-full"
      src="/images/nature-2.avif"
    >
      <ImageViewer.Trigger className="block w-full">
        <ImageViewer.StaticImage className="mx-auto block max-w-full" />
      </ImageViewer.Trigger>
      <ImageViewer.FloatingPortal>
        <ImageViewer.CloseButton />
        <ImageViewer.Viewport>
          <ImageViewer.ViewportImage />
        </ImageViewer.Viewport>
        <ButtonGroup aria-label="Image controls" size="sm">
          <ImageViewer.ZoomOutButton />
          <ImageViewer.ZoomInButton />
          <ImageViewer.ResetButton />
        </ButtonGroup>
      </ImageViewer.FloatingPortal>
    </ImageViewer.Root>
  )
}

Controlled Open State

Use open and onOpenChange for controlled popup visibility. These props follow our controlled state pattern.

import {useState, type ReactElement} from "react"

import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerControlledOpenDemo(): ReactElement {
  const [open, setOpen] = useState(false)

  return (
    <ImageViewer
      alt="Scenic view of a lake in the mountains"
      className="w-full"
      onOpenChange={setOpen}
      open={open}
      src="/images/nature-2.avif"
    />
  )
}

Controlled Zoom

Set zoom and update it in onZoomChange. These props follow our controlled state pattern.

1.0x
import {type ReactElement, useState} from "react"

import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerControlledZoomDemo(): ReactElement {
  const [zoom, setZoom] = useState(1)

  return (
    <div className="flex w-full flex-col items-center gap-4">
      <ImageViewer
        alt="Scenic view of a lake in the mountains"
        className="w-full"
        onZoomChange={(details) => setZoom(details.zoom)}
        src="/images/nature-2.avif"
        zoom={zoom}
      />
      <output>{zoom.toFixed(1)}x</output>
    </div>
  )
}

Zoom Limits

Set minZoom and maxZoom to constrain the zoom range.

1.0x

Zoom is limited to 0.5x through 2x.

import {type ReactElement, useState} from "react"

import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

const minZoom = 0.5
const maxZoom = 2

export function ImageViewerZoomLimitsDemo(): ReactElement {
  const [zoom, setZoom] = useState(1)

  return (
    <div className="flex w-full flex-col items-center gap-4">
      <ImageViewer
        alt="Scenic view of a lake in the mountains"
        className="w-full"
        maxZoom={maxZoom}
        minZoom={minZoom}
        onZoomChange={(details) => setZoom(details.zoom)}
        src="/images/nature-2.avif"
        zoom={zoom}
      />
      <output>{zoom.toFixed(1)}x</output>
      <p className="text-body-sm text-neutral-secondary">
        Zoom is limited to {minZoom}x through {maxZoom}x.
      </p>
    </div>
  )
}

Rotation

Set rotation and update it in onRotationChange. These props follow our controlled state pattern.

import {type ReactElement, useState} from "react"

import {RotateCcw, RotateCw} from "lucide-react"

import {ButtonGroup, IconButton} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerRotationDemo(): ReactElement {
  const [rotation, setRotation] = useState(0)

  return (
    <div className="flex w-full flex-col items-center gap-4">
      <ImageViewer.Root
        alt="Scenic view of a lake in the mountains"
        className="w-full"
        onRotationChange={(details) => setRotation(details.rotation)}
        rotation={rotation}
        src="/images/nature-2.avif"
      >
        <ImageViewer.Trigger className="block w-full">
          <ImageViewer.StaticImage className="mx-auto block max-w-full" />
        </ImageViewer.Trigger>
        <ImageViewer.FloatingPortal>
          <ImageViewer.CloseButton />
          <ImageViewer.Viewport>
            <ImageViewer.ViewportImage />
          </ImageViewer.Viewport>
          <div className="flex items-center gap-2">
            <ButtonGroup
              aria-label="Rotation controls"
              emphasis="white-persistent"
              size="sm"
              variant="outline"
            >
              <IconButton
                aria-label="Rotate counter-clockwise"
                icon={RotateCcw}
                onClick={() =>
                  setRotation((currentRotation) => currentRotation - 90)
                }
              />
              <IconButton
                aria-label="Rotate clockwise"
                icon={RotateCw}
                onClick={() =>
                  setRotation((currentRotation) => currentRotation + 90)
                }
              />
            </ButtonGroup>
            <output>{rotation}°</output>
          </div>
        </ImageViewer.FloatingPortal>
      </ImageViewer.Root>
    </div>
  )
}

Flip

Set flip and update it in onFlipChange. These props follow our controlled state pattern.

import {type ReactElement, useState} from "react"

import {FlipHorizontal, FlipVertical} from "lucide-react"

import {ButtonGroup, IconButton} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerFlipDemo(): ReactElement {
  const [flip, setFlip] = useState({horizontal: false, vertical: false})

  return (
    <div className="flex w-full flex-col items-center gap-4">
      <ImageViewer.Root
        alt="Scenic view of a lake in the mountains"
        className="w-full"
        flip={flip}
        onFlipChange={(details) => setFlip(details.flip)}
        src="/images/nature-2.avif"
      >
        <ImageViewer.Trigger className="block w-full">
          <ImageViewer.StaticImage className="mx-auto block max-w-full" />
        </ImageViewer.Trigger>
        <ImageViewer.FloatingPortal>
          <ImageViewer.CloseButton />
          <ImageViewer.Viewport>
            <ImageViewer.ViewportImage />
          </ImageViewer.Viewport>
          <ButtonGroup
            aria-label="Flip controls"
            emphasis="white-persistent"
            size="sm"
          >
            <IconButton
              aria-label="Flip horizontally"
              emphasis="white-persistent"
              icon={FlipHorizontal}
              onClick={() =>
                setFlip((currentFlip) => ({
                  ...currentFlip,
                  horizontal: !currentFlip.horizontal,
                }))
              }
              variant={flip.horizontal ? "fill" : "outline"}
            />
            <IconButton
              aria-label="Flip vertically"
              icon={FlipVertical}
              onClick={() =>
                setFlip((currentFlip) => ({
                  ...currentFlip,
                  vertical: !currentFlip.vertical,
                }))
              }
              variant={flip.vertical ? "fill" : "outline"}
            />
          </ButtonGroup>
        </ImageViewer.FloatingPortal>
      </ImageViewer.Root>
    </div>
  )
}

Reset

Use useImageViewer with <RootProvider> when external code owns the viewer state and popup composition.

import type {ReactElement} from "react"

import {
  FlipHorizontal,
  RefreshCw,
  RotateCcw,
  RotateCw,
  ZoomIn,
  ZoomOut,
} from "lucide-react"

import {useImageViewer} from "@qualcomm-ui/react-core/image-viewer"
import {ButtonGroup, IconButton} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerResetDemo(): ReactElement {
  const imageViewer = useImageViewer()

  return (
    <ImageViewer.RootProvider
      alt="Scenic view of a lake in the mountains"
      className="w-full"
      src="/images/nature-2.avif"
      value={imageViewer}
    >
      <ImageViewer.Trigger className="block w-full">
        <ImageViewer.StaticImage className="mx-auto block max-w-full" />
      </ImageViewer.Trigger>
      <ImageViewer.FloatingPortal>
        <ImageViewer.CloseButton />
        <ImageViewer.Viewport>
          <ImageViewer.ViewportImage />
        </ImageViewer.Viewport>
        <ButtonGroup
          aria-label="Image controls"
          emphasis="white-persistent"
          size="sm"
          variant="outline"
        >
          <IconButton
            aria-label="Zoom out"
            icon={ZoomOut}
            onClick={() => imageViewer.zoomBy(-0.1)}
          />
          <IconButton
            aria-label="Zoom in"
            icon={ZoomIn}
            onClick={() => imageViewer.zoomBy(0.1)}
          />
          <IconButton
            aria-label="Rotate counter-clockwise"
            icon={RotateCcw}
            onClick={() => imageViewer.rotateBy(-90)}
          />
          <IconButton
            aria-label="Rotate clockwise"
            icon={RotateCw}
            onClick={() => imageViewer.rotateBy(90)}
          />
          <IconButton
            aria-label="Flip horizontally"
            icon={FlipHorizontal}
            onClick={() => imageViewer.flipHorizontally()}
          />
          <IconButton
            aria-label="Reset image"
            icon={RefreshCw}
            onClick={() => imageViewer.reset()}
          />
        </ButtonGroup>
      </ImageViewer.FloatingPortal>
    </ImageViewer.RootProvider>
  )
}

Events

Use onZoomChange to track the current zoom level.

Current zoom: 1.00x
import {type ReactElement, useState} from "react"

import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerEventsDemo(): ReactElement {
  const [zoom, setZoom] = useState(1)

  return (
    <div className="flex w-full flex-col gap-4">
      <ImageViewer
        alt="Scenic view of a lake in the mountains"
        className="w-full"
        onZoomChange={(details) => setZoom(details.zoom)}
        src="/images/nature-2.avif"
      />
      <output>Current zoom: {zoom.toFixed(2)}x</output>
    </div>
  )
}

Context

Use <ImageViewer.Context> to access the viewer API inside the root.

import type {ReactElement} from "react"

import {ZoomIn, ZoomOut} from "lucide-react"

import {ButtonGroup, IconButton} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerContextDemo(): ReactElement {
  return (
    <ImageViewer.Root
      alt="Scenic view of a lake in the mountains"
      className="w-full"
      src="/images/nature-2.avif"
    >
      <ImageViewer.Trigger className="block w-full">
        <ImageViewer.StaticImage className="mx-auto block max-w-full" />
      </ImageViewer.Trigger>
      <ImageViewer.FloatingPortal>
        <ImageViewer.CloseButton />
        <ImageViewer.Viewport>
          <ImageViewer.ViewportImage />
        </ImageViewer.Viewport>
        <ImageViewer.Context>
          {(context) => (
            <div className="flex items-center justify-center gap-2">
              <ButtonGroup
                aria-label="Zoom controls"
                emphasis="white-persistent"
                size="sm"
                variant="outline"
              >
                <IconButton
                  aria-label="Zoom out"
                  icon={ZoomOut}
                  onClick={() => context.zoomBy(-0.1)}
                />
                <IconButton
                  aria-label="Zoom in"
                  icon={ZoomIn}
                  onClick={() => context.zoomBy(0.1)}
                />
              </ButtonGroup>
              <output>{context.zoom.toFixed(1)}x</output>
            </div>
          )}
        </ImageViewer.Context>
      </ImageViewer.FloatingPortal>
    </ImageViewer.Root>
  )
}

Root Provider

Use useImageViewer with <ImageViewer.RootProvider> when external code owns the viewer API.

import type {ReactElement} from "react"

import {ZoomIn, ZoomOut} from "lucide-react"

import {useImageViewer} from "@qualcomm-ui/react-core/image-viewer"
import {ButtonGroup, IconButton} from "@qualcomm-ui/react/button"
import {ImageViewer} from "@qualcomm-ui/react/image-viewer"

export function ImageViewerRootProviderDemo(): ReactElement {
  const imageViewer = useImageViewer()

  return (
    <ImageViewer.RootProvider
      alt="Scenic view of a lake in the mountains"
      className="w-full"
      src="/images/nature-2.avif"
      value={imageViewer}
    >
      <ImageViewer.Trigger className="block w-full">
        <ImageViewer.StaticImage className="mx-auto block max-w-full" />
      </ImageViewer.Trigger>
      <ImageViewer.FloatingPortal>
        <ImageViewer.CloseButton />
        <ImageViewer.Viewport>
          <ImageViewer.ViewportImage />
        </ImageViewer.Viewport>
        <div className="flex items-center justify-center gap-2">
          <ButtonGroup
            aria-label="Zoom controls"
            emphasis="white-persistent"
            size="sm"
            variant="outline"
          >
            <IconButton
              aria-label="Zoom out"
              icon={ZoomOut}
              onClick={() => imageViewer.setZoom(imageViewer.zoom - 0.1)}
            />
            <IconButton
              aria-label="Zoom in"
              icon={ZoomIn}
              onClick={() => imageViewer.setZoom(imageViewer.zoom + 0.1)}
            />
          </ButtonGroup>
          <output>{imageViewer.zoom.toFixed(1)}x</output>
        </div>
      </ImageViewer.FloatingPortal>
    </ImageViewer.RootProvider>
  )
}

API

<ImageViewer>

The simple API accepts the props from ImageViewer.Root except children. It renders the preview, popup, zoom controls, and reset control. Use the composite API for custom popup contents.

Displays an image preview that opens a popup with zoom and reset controls.
PropType
The simple ImageViewer doesn't support children.
never
Props applied to the close button.
Props applied to the button group containing the zoom and reset controls.
ButtonGroupProps
Props applied to the portal, backdrop, positioner, and popup content.
Props applied to the reset button.
Props applied to the static preview image. Its src and alt default to the root values.
Props applied to the preview button that opens the popup.
Props applied to the expanded image. Its src and alt default to the root values.
Props applied to the pan and zoom viewport.
Props applied to the zoom in button.
Props applied to the zoom out button.
Type
never
Description
The simple ImageViewer doesn't support children.
Description
Props applied to the close button.
Type
ButtonGroupProps
Description
Props applied to the button group containing the zoom and reset controls.
Description
Props applied to the portal, backdrop, positioner, and popup content.
Description
Props applied to the reset button.
Description
Props applied to the static preview image. Its src and alt default to the root values.
Description
Props applied to the preview button that opens the popup.
Description
Props applied to the expanded image. Its src and alt default to the root values.
Description
Props applied to the pan and zoom viewport.
Description
Props applied to the zoom in button.
Description
Props applied to the zoom out button.

ImageViewerApi

The viewer API is available from <ImageViewer.Context> and useImageViewer.

Use open and setOpen to read and update popup visibility when external code owns the viewer API.

PropType
The current flip state of the image.
{
horizontal: boolean
vertical: boolean
}
Function to flip the image horizontally. Pass a boolean to set explicitly or omit to toggle.
    (
    value?: boolean,
    ) => void
    Function to flip the image vertically. Pass a boolean to set explicitly or omit to toggle.
      (
      value?: boolean,
      ) => void
      Resolves the inline root for portal placement.
        () => HTMLElement
        Resolves the document or shadow root that owns the viewer.
          () =>
          | Node
          | ShadowRoot
          | Document
          Resolves the interactive viewport for popup focus management.
            () => HTMLElement
            Measures the mounted viewport after its aspect ratio has been applied.
              () => void
              The natural (original) size of the image.
              {
              height: number
              width: number
              }
              The current offset (pan position) of the image.
              {
              x: number
              y: number
              }
              Whether the popup is open.
              boolean
              Whether the image is currently being panned.
              boolean
              Whether the expanded image is loaded and its viewport has been measured.
              boolean
              Function to reset the viewer to its initial state.
                () => void
                Function to rotate the image by a relative amount in degrees.
                  (
                  degrees: number,
                  ) => void
                  The current rotation of the image in degrees.
                  number
                  Function to set the flip state of the image.
                    (
                    flip: Partial<{
                    horizontal: boolean
                    vertical: boolean
                    }>,
                    ) => void
                    Updates the mounted image's natural dimensions and loading status.
                      (status: {
                      ready: boolean
                      size: {
                      height: number
                      width: number
                      }
                      }) => void
                      Requests a popup open state change. Closing restores the initial transform.
                        (
                        open: boolean,
                        ) => void
                        Function to set the rotation of the image.
                          (
                          rotation: number,
                          ) => void
                          Function to set the zoom level of the image.
                            (
                            zoom: number,
                            ) => void
                            Localized labels for the popup controls.
                            {
                            listLabel?: string
                            }
                            The viewport rectangle dimensions and position.
                            {
                            bottom: number
                            height: number
                            left: number
                            right: number
                            top: number
                            width: number
                            }
                            The current zoom level of the image.
                            number
                            Function to zoom the image by a relative amount.
                              (
                              delta: number,
                              ) => void
                              Type
                              {
                              horizontal: boolean
                              vertical: boolean
                              }
                              Description
                              The current flip state of the image.
                              Type
                              (
                              value?: boolean,
                              ) => void
                              Description
                              Function to flip the image horizontally. Pass a boolean to set explicitly or omit to toggle.
                                Type
                                (
                                value?: boolean,
                                ) => void
                                Description
                                Function to flip the image vertically. Pass a boolean to set explicitly or omit to toggle.
                                  Type
                                  () => HTMLElement
                                  Description
                                  Resolves the inline root for portal placement.
                                    Type
                                    () =>
                                    | Node
                                    | ShadowRoot
                                    | Document
                                    Description
                                    Resolves the document or shadow root that owns the viewer.
                                      Type
                                      () => HTMLElement
                                      Description
                                      Resolves the interactive viewport for popup focus management.
                                        Type
                                        () => void
                                        Description
                                        Measures the mounted viewport after its aspect ratio has been applied.
                                          Type
                                          {
                                          height: number
                                          width: number
                                          }
                                          Description
                                          The natural (original) size of the image.
                                          Type
                                          {
                                          x: number
                                          y: number
                                          }
                                          Description
                                          The current offset (pan position) of the image.
                                          Type
                                          boolean
                                          Description
                                          Whether the popup is open.
                                          Type
                                          boolean
                                          Description
                                          Whether the image is currently being panned.
                                          Type
                                          boolean
                                          Description
                                          Whether the expanded image is loaded and its viewport has been measured.
                                          Type
                                          () => void
                                          Description
                                          Function to reset the viewer to its initial state.
                                            Type
                                            (
                                            degrees: number,
                                            ) => void
                                            Description
                                            Function to rotate the image by a relative amount in degrees.
                                              Type
                                              number
                                              Description
                                              The current rotation of the image in degrees.
                                              Type
                                              (
                                              flip: Partial<{
                                              horizontal: boolean
                                              vertical: boolean
                                              }>,
                                              ) => void
                                              Description
                                              Function to set the flip state of the image.
                                                Type
                                                (status: {
                                                ready: boolean
                                                size: {
                                                height: number
                                                width: number
                                                }
                                                }) => void
                                                Description
                                                Updates the mounted image's natural dimensions and loading status.
                                                  Type
                                                  (
                                                  open: boolean,
                                                  ) => void
                                                  Description
                                                  Requests a popup open state change. Closing restores the initial transform.
                                                    Type
                                                    (
                                                    rotation: number,
                                                    ) => void
                                                    Description
                                                    Function to set the rotation of the image.
                                                      Type
                                                      (
                                                      zoom: number,
                                                      ) => void
                                                      Description
                                                      Function to set the zoom level of the image.
                                                        Type
                                                        {
                                                        listLabel?: string
                                                        }
                                                        Description
                                                        Localized labels for the popup controls.
                                                        Type
                                                        {
                                                        bottom: number
                                                        height: number
                                                        left: number
                                                        right: number
                                                        top: number
                                                        width: number
                                                        }
                                                        Description
                                                        The viewport rectangle dimensions and position.
                                                        Type
                                                        number
                                                        Description
                                                        The current zoom level of the image.
                                                        Type
                                                        (
                                                        delta: number,
                                                        ) => void
                                                        Description
                                                        Function to zoom the image by a relative amount.

                                                          Composite API

                                                          <ImageViewer.Root>

                                                          src and alt are defaults that either image can override.

                                                          Groups the image viewer parts and manages their state.
                                                          PropTypeDefault
                                                          Default alternative text for StaticImage and ViewportImage.
                                                          string
                                                          The initial flip state to apply to the image.
                                                          {
                                                          horizontal: boolean
                                                          vertical: boolean
                                                          }
                                                          { horizontal: false, vertical: false }
                                                          
                                                          Whether the popup is initially open.
                                                          boolean
                                                          false
                                                          
                                                          The initial rotation to apply to the image in degrees.
                                                          number
                                                          0
                                                          
                                                          The initial zoom factor to apply to the image.
                                                          number
                                                          1
                                                          
                                                          The document's text/writing direction.
                                                          'ltr' | 'rtl'
                                                          'ltr'
                                                          
                                                          The controlled flip state of the image.
                                                          {
                                                          horizontal: boolean
                                                          vertical: boolean
                                                          }
                                                          A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
                                                            () =>
                                                            | Node
                                                            | ShadowRoot
                                                            | Document
                                                            The ids of the image viewer elements
                                                            Partial<{
                                                            root: string
                                                            viewport: string
                                                            viewportImage: string
                                                            }>
                                                            The maximum zoom factor allowed.
                                                            number
                                                            5
                                                            
                                                            The minimum zoom factor allowed.
                                                            number
                                                            1
                                                            
                                                            The base nudge step for keyboard arrow keys (in pixels).
                                                            number
                                                            1
                                                            
                                                            The nudge step when Ctrl/Cmd key is held (in pixels).
                                                            number
                                                            50
                                                            
                                                            The nudge step when Shift key is held (in pixels).
                                                            number
                                                            10
                                                            
                                                            Callback fired when the flip state changes.
                                                              (details: {
                                                              flip: {
                                                              horizontal: boolean
                                                              vertical: boolean
                                                              }
                                                              }) => void
                                                              Called when the popup requests an open state change.
                                                                (
                                                                open: boolean,
                                                                ) => void
                                                                Callback fired when the rotation changes.
                                                                  (details: {
                                                                  rotation: number
                                                                  }) => void
                                                                  Callback fired when the zoom level changes.
                                                                    (details: {
                                                                    zoom: number
                                                                    }) => void
                                                                    The controlled popup open state.
                                                                    boolean
                                                                    Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                    | ReactElement
                                                                    | ((
                                                                    props: object,
                                                                    ) => ReactElement)
                                                                    The controlled rotation of the image in degrees (0 - 360).
                                                                    number
                                                                    Default image source for StaticImage and ViewportImage.
                                                                    string
                                                                    Specifies the localized strings that identify accessibility elements and their states.
                                                                    {
                                                                    listLabel?: string
                                                                    }
                                                                    The controlled zoom level of the image.
                                                                    number
                                                                    Controls how responsive pinch-to-zoom is.
                                                                    number
                                                                    2
                                                                    
                                                                    The amount of zoom applied per wheel step.
                                                                    number
                                                                    0.1
                                                                    
                                                                    Type
                                                                    string
                                                                    Description
                                                                    Default alternative text for StaticImage and ViewportImage.
                                                                    Type
                                                                    {
                                                                    horizontal: boolean
                                                                    vertical: boolean
                                                                    }
                                                                    Description
                                                                    The initial flip state to apply to the image.
                                                                    Type
                                                                    boolean
                                                                    Description
                                                                    Whether the popup is initially open.
                                                                    Type
                                                                    number
                                                                    Description
                                                                    The initial rotation to apply to the image in degrees.
                                                                    Type
                                                                    number
                                                                    Description
                                                                    The initial zoom factor to apply to the image.
                                                                    Type
                                                                    'ltr' | 'rtl'
                                                                    Description
                                                                    The document's text/writing direction.
                                                                    Type
                                                                    {
                                                                    horizontal: boolean
                                                                    vertical: boolean
                                                                    }
                                                                    Description
                                                                    The controlled flip state of the image.
                                                                    Type
                                                                    () =>
                                                                    | Node
                                                                    | ShadowRoot
                                                                    | Document
                                                                    Description
                                                                    A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
                                                                      Type
                                                                      Partial<{
                                                                      root: string
                                                                      viewport: string
                                                                      viewportImage: string
                                                                      }>
                                                                      Description
                                                                      The ids of the image viewer elements
                                                                      Type
                                                                      number
                                                                      Description
                                                                      The maximum zoom factor allowed.
                                                                      Type
                                                                      number
                                                                      Description
                                                                      The minimum zoom factor allowed.
                                                                      Type
                                                                      number
                                                                      Description
                                                                      The base nudge step for keyboard arrow keys (in pixels).
                                                                      Type
                                                                      number
                                                                      Description
                                                                      The nudge step when Ctrl/Cmd key is held (in pixels).
                                                                      Type
                                                                      number
                                                                      Description
                                                                      The nudge step when Shift key is held (in pixels).
                                                                      Type
                                                                      (details: {
                                                                      flip: {
                                                                      horizontal: boolean
                                                                      vertical: boolean
                                                                      }
                                                                      }) => void
                                                                      Description
                                                                      Callback fired when the flip state changes.
                                                                        Type
                                                                        (
                                                                        open: boolean,
                                                                        ) => void
                                                                        Description
                                                                        Called when the popup requests an open state change.
                                                                          Type
                                                                          (details: {
                                                                          rotation: number
                                                                          }) => void
                                                                          Description
                                                                          Callback fired when the rotation changes.
                                                                            Type
                                                                            (details: {
                                                                            zoom: number
                                                                            }) => void
                                                                            Description
                                                                            Callback fired when the zoom level changes.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              The controlled popup open state.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              number
                                                                              Description
                                                                              The controlled rotation of the image in degrees (0 - 360).
                                                                              Type
                                                                              string
                                                                              Description
                                                                              Default image source for StaticImage and ViewportImage.
                                                                              Type
                                                                              {
                                                                              listLabel?: string
                                                                              }
                                                                              Description
                                                                              Specifies the localized strings that identify accessibility elements and their states.
                                                                              Type
                                                                              number
                                                                              Description
                                                                              The controlled zoom level of the image.
                                                                              Type
                                                                              number
                                                                              Description
                                                                              Controls how responsive pinch-to-zoom is.
                                                                              Type
                                                                              number
                                                                              Description
                                                                              The amount of zoom applied per wheel step.

                                                                              <ImageViewer.Trigger>

                                                                              A static preview button that opens the image popup.
                                                                              PropType
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.RootProvider>

                                                                              Groups image viewer parts using an externally created API.
                                                                              PropType
                                                                              An image viewer API created with useImageViewer.
                                                                              Default alternative text for StaticImage and ViewportImage.
                                                                              string
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Default image source for StaticImage and ViewportImage.
                                                                              string
                                                                              Description
                                                                              An image viewer API created with useImageViewer.
                                                                              Type
                                                                              string
                                                                              Description
                                                                              Default alternative text for StaticImage and ViewportImage.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              string
                                                                              Description
                                                                              Default image source for StaticImage and ViewportImage.

                                                                              Shortcuts

                                                                              <ImageViewer.FloatingPortal>

                                                                              ImageViewer.FloatingPortal combines the portal, backdrop, positioner, and content elements.

                                                                              import {Portal} from "@qualcomm-ui/react-core/portal"
                                                                              
                                                                              ;<Portal {...props}>
                                                                                <ImageViewer.Backdrop {...backdropProps} />
                                                                                <ImageViewer.Positioner {...positionerProps}>
                                                                                  <ImageViewer.Content {...contentProps}>{children}</ImageViewer.Content>
                                                                                </ImageViewer.Positioner>
                                                                              </Portal>
                                                                              Combines a portal, backdrop, positioner, and content for the image popup.
                                                                              PropType
                                                                              Props applied to the backdrop.
                                                                              Popup contents, including the viewport and controls.
                                                                              Specify to override the container element.
                                                                              | HTMLElement
                                                                              | ShadowRoot
                                                                              | RefObject<
                                                                              HTMLElement | ShadowRoot
                                                                              >
                                                                              Props applied to the content.
                                                                              Disable the portal conditionally. This causes the children to be rendered as-is.
                                                                              boolean
                                                                              Props applied to the positioner.
                                                                              Description
                                                                              Props applied to the backdrop.
                                                                              Description
                                                                              Popup contents, including the viewport and controls.
                                                                              Type
                                                                              | HTMLElement
                                                                              | ShadowRoot
                                                                              | RefObject<
                                                                              HTMLElement | ShadowRoot
                                                                              >
                                                                              Description
                                                                              Specify to override the container element.
                                                                              Description
                                                                              Props applied to the content.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              Disable the portal conditionally. This causes the children to be rendered as-is.
                                                                              Description
                                                                              Props applied to the positioner.

                                                                              <ImageViewer.Backdrop>

                                                                              Dims the page behind the expanded image.
                                                                              PropType
                                                                              React children prop.
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              string
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              React children prop.
                                                                              Type
                                                                              string
                                                                              Description
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.Positioner>

                                                                              Positions the popup inside the padded browser viewport.
                                                                              PropType
                                                                              React children prop.
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              string
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              React children prop.
                                                                              Type
                                                                              string
                                                                              Description
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.Content>

                                                                              Contains the image viewport and an optional row of controls.
                                                                              PropType
                                                                              React children prop.
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              string
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              React children prop.
                                                                              Type
                                                                              string
                                                                              Description
                                                                              id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.CloseButton>

                                                                              Closes the popup and restores the initial transform.
                                                                              PropTypeDefault
                                                                              The density of the button. Governs padding and height.
                                                                              | 'default'
                                                                              | 'compact'
                                                                              'default'
                                                                              
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              boolean
                                                                              false
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              'neutral'
                                                                              
                                                                              Icon displayed in the close button.
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              Minimize2
                                                                              
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Governs the shape of the icon button.
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              'square'
                                                                              
                                                                              The size of the component and its icons.
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              'md'
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              'fill'
                                                                              
                                                                              Type
                                                                              | 'default'
                                                                              | 'compact'
                                                                              Description
                                                                              The density of the button. Governs padding and height.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              Type
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              Description
                                                                              The style variant of the button. Governs colors.
                                                                              Type
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              Description
                                                                              Icon displayed in the close button.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              Description
                                                                              Governs the shape of the icon button.
                                                                              Type
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              Description
                                                                              The size of the component and its icons.
                                                                              Type
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              Description
                                                                              The style variant of the button. Governs colors.

                                                                              Viewer API

                                                                              <ImageViewer.Viewport>

                                                                              The focusable viewport containing ViewportImage and handling pan and zoom.
                                                                              PropType
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.StaticImage>

                                                                              The inline image. Its src and alt default to the root values.
                                                                              PropType
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.ViewportImage>

                                                                              The expanded image inside Viewport. Its src and alt default to the root values.
                                                                              PropType
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more

                                                                              <ImageViewer.Context>

                                                                              PropType
                                                                              Renders content using the current image viewer API.
                                                                              Description
                                                                              Renders content using the current image viewer API.

                                                                              <ImageViewer.ZoomInButton>

                                                                              Increases the image zoom level.
                                                                              PropTypeDefault
                                                                              The density of the button. Governs padding and height.
                                                                              | 'default'
                                                                              | 'compact'
                                                                              'default'
                                                                              
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              boolean
                                                                              false
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              'neutral'
                                                                              
                                                                              Icon displayed in the button.
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              ZoomIn
                                                                              
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Governs the shape of the icon button.
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              'square'
                                                                              
                                                                              The size of the component and its icons.
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              'md'
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              'fill'
                                                                              
                                                                              Type
                                                                              | 'default'
                                                                              | 'compact'
                                                                              Description
                                                                              The density of the button. Governs padding and height.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              Type
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              Description
                                                                              The style variant of the button. Governs colors.
                                                                              Type
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              Description
                                                                              Icon displayed in the button.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              Description
                                                                              Governs the shape of the icon button.
                                                                              Type
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              Description
                                                                              The size of the component and its icons.
                                                                              Type
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              Description
                                                                              The style variant of the button. Governs colors.

                                                                              <ImageViewer.ZoomOutButton>

                                                                              Decreases the image zoom level.
                                                                              PropTypeDefault
                                                                              The density of the button. Governs padding and height.
                                                                              | 'default'
                                                                              | 'compact'
                                                                              'default'
                                                                              
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              boolean
                                                                              false
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              'neutral'
                                                                              
                                                                              Icon displayed in the button.
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              ZoomOut
                                                                              
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Governs the shape of the icon button.
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              'square'
                                                                              
                                                                              The size of the component and its icons.
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              'md'
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              'fill'
                                                                              
                                                                              Type
                                                                              | 'default'
                                                                              | 'compact'
                                                                              Description
                                                                              The density of the button. Governs padding and height.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              Type
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              Description
                                                                              The style variant of the button. Governs colors.
                                                                              Type
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              Description
                                                                              Icon displayed in the button.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              Description
                                                                              Governs the shape of the icon button.
                                                                              Type
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              Description
                                                                              The size of the component and its icons.
                                                                              Type
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              Description
                                                                              The style variant of the button. Governs colors.

                                                                              <ImageViewer.ResetButton>

                                                                              Restores the initial image transforms.
                                                                              PropTypeDefault
                                                                              The density of the button. Governs padding and height.
                                                                              | 'default'
                                                                              | 'compact'
                                                                              'default'
                                                                              
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              boolean
                                                                              false
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              'neutral'
                                                                              
                                                                              Icon displayed in the button.
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              RefreshCw
                                                                              
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Governs the shape of the icon button.
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              'square'
                                                                              
                                                                              The size of the component and its icons.
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              'md'
                                                                              
                                                                              The style variant of the button. Governs colors.
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              'fill'
                                                                              
                                                                              Type
                                                                              | 'default'
                                                                              | 'compact'
                                                                              Description
                                                                              The density of the button. Governs padding and height.
                                                                              Type
                                                                              boolean
                                                                              Description
                                                                              Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
                                                                              Type
                                                                              | 'neutral'
                                                                              | 'primary'
                                                                              | 'danger'
                                                                              | 'persistent-white'
                                                                              | 'persistent-black'
                                                                              | 'inverse'
                                                                              | 'white-persistent'
                                                                              | 'black-persistent'
                                                                              Description
                                                                              The style variant of the button. Governs colors.
                                                                              Type
                                                                              | LucideIcon
                                                                              | ReactNode
                                                                              Description
                                                                              Icon displayed in the button.
                                                                              Type
                                                                              | ReactElement
                                                                              | ((
                                                                              props: object,
                                                                              ) => ReactElement)
                                                                              Description
                                                                              Allows you to replace the component's HTML element with a different tag or component. Learn more
                                                                              Type
                                                                              | 'square'
                                                                              | 'rounded'
                                                                              Description
                                                                              Governs the shape of the icon button.
                                                                              Type
                                                                              | 'sm'
                                                                              | 'md'
                                                                              | 'lg'
                                                                              Description
                                                                              The size of the component and its icons.
                                                                              Type
                                                                              | 'fill'
                                                                              | 'ghost'
                                                                              | 'outline'
                                                                              Description
                                                                              The style variant of the button. Governs colors.
                                                                              Last updated on by Ryan Bower