Vitepress Theme Akari Docsv1.0.0GitHubSettingsMore

Image preview ​

AkariImagePreview wraps a picture in a thumbnail that opens to fill the content area, where it can be zoomed, rotated and panned, with the keyboard doing the same work.

Usage ​

html
<AkariImagePreview src="/hero/theme-hero.svg" alt="The theme" label="View the theme">
  <img src="/hero/theme-hero.svg" alt="The theme" width="360" />
</AkariImagePreview>

The default slot is the thumbnail. Leave it out and the component renders an <img> of its own. Provide it and the component uses your markup as-is, only wrapping it in a button.

Props, slots, CSS classes and exported geometry functions are documented on the API tab.

Keyboard ​

KeyAction
EscClose the preview
+, =Zoom in one step
-, _Zoom out one step
0Reset the view
rRotate 90° clockwise
Shift + rRotate 90° counter-clockwise

Zoom runs from 50% to 400%, by wheel, double-click or the buttons in the bar. Drag to pan; double-click the picture or press the reset button to return to the opening view.

Motion and fallbacks ​

Opening grows the picture out of its thumbnail and closing shrinks it back. Once the view has been zoomed, rotated or panned that animation is skipped and the overlay only fades, because there is no longer a single thumbnail-sized box for it to return to. With reduced motion enabled the overlay only fades throughout.

The overlay is teleported to .akari-frame, so the prose column and its overflow cannot clip it. Page scrolling is locked while it is open, and focus returns to the trigger on close.

GitHub Settings

Search the docs

Type a page title, a component name or words from the text.

Press ⌘/Ctrl + K to open it anytime

Choose a language

EnglishEnglish (United States)العربيةArabic (Saudi Arabia)FrançaisFrench (France)日本語Japanese (Japan)한국어Korean (South Korea)简体中文Chinese (China)

Settings

Color
VariantTonal SpotVibrantFidelityExpressiveMonochromeNeutralRainbowFruit Salad
ContrastDefaultMediumHigh
MotionStandardExpressive
Text directionFollow languageLeft to rightRight to left
Text size100%150%200%