Skip to content
ArcadiaDesign

TSX

A picture over the whole window, in an Overlay. It grows from the picture pressed (from) and goes back into its place as it closes (placeOf), moving one layer and nothing else; under reduced motion it fades. The preview shows the moment it opens and the original takes its place once decoded, the same picture, so nothing flashes. The pictures beside the one shown are fetched ahead, and around asks the product for more as either end nears.

The words never cover the picture: it is fitted into the box the bar and the foot leave, by their measured heights, and that box holds while they step back under a resting pointer. At rest the words are three lines, their end faded; pressed, they open whole over the scrim, scrolling inside themselves, at most half the window. The bar holds the product's who and when, its actions (a panel opens a surface beside its button), and Close. The pictures of one group stand as a strip under each of them.

Closer and around: a pinch, and Ctrl or Command with the wheel, zoom at the pointer, and so does a mouse's wheel; a trackpad's slide moves a zoomed picture; a drag moves a zoomed picture and swipes one shown whole; a double press goes between the whole picture and its true size. A zoomed picture always stops at its own edges. A moving picture plays here, and under reduced motion it rests on its first frame until its GIF mark is pressed.

Examples

rootStyle takes the knob below.

--image-viewer-measure
Ref<Measure>Default var(--thread-width)
The column its words stand in. Default a conversation's.

A modal dialog named by the picture's label, the page behind inert; the picture shown carries that name as its alt text. The arrows at its sides are buttons named Previous and Next, there where a pointer can hover; on touch a swipe and a press that shows or hides the bar do it. The words at rest are one Tab stop that opens them. The browser's Back closes it too. Closing gives the focus to the picture's own place, else to what had it. It does so once the overlay is gone, so a product that then moves the focus elsewhere (to its message field, after a reply) does it one frame later.

Left, Right
The previous and the next picture
Esc
Closes the words opened, then the viewer
0
The whole picture
, -
Closer and further, at the middle
Enter, Space on the words
Opens them whole

ImageViewer

imagesrequired
readonly T[]
The pictures it goes through, in order.
indexrequired
number
The one it opens on.
from
HTMLElement | nullDefault null
The picture's place it grows from, and goes back into as it closes.
around
ViewerAround<T>
The pictures before and after one: asked as it opens and as either end nears. Without it, images are all.
label
(image: T) => stringDefault (i) => i.name ?? "Image"
Each picture's name for assistive technology. Default its own name, else "Image".
who
(image: T) => ReactNode
The bar's start: who sent the picture shown and when.
caption
(image: T) => ReactNode
The words under it, or null.
actions
(image: T) => readonly ViewerAction[]
What can be done with it, in the bar before its own Close.
placeOf
(image: T) => HTMLElement | nullDefault from
A picture's own place on the page, where closing puts it back and gives the focus. For the first.
onCloserequired
() => void
It has gone, its closing finished: the product takes it away.
rootStyle
RootStyle<ImageViewerKnobs>
Typed StyleX override: --image-viewer-measure.