Aspect Ratio
Gallery Skeleton
A gallery skeleton: the frames occupy exactly the space the photos will, so the page does not jump when they load.
- aspect ratio
- skeleton
- gallery
- loading
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/aspect-008?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "aspect-008" (Gallery Skeleton) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/aspect-008.json
Registry item: https://vibeui.ru/r/aspect-008.json
Installs to: components/vibeui/aspect-008.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A gallery skeleton: the frames occupy exactly the space the photos will, so the page does not jump when they load.
A grid of gallery placeholders: the tiles hold the given ratio, a shimmer passes across them with a delay, and both count and proportion are props. Zero dependencies, one file, its own palette, no client JS.
## 3. How to use it
import { Aspect008 } from "@/components/vibeui/aspect-008"
<Aspect008 ratio="4 / 3" count={6} label="Loading photos" />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-aspect-008-* palette — do not swap it for your theme tokens (bg-muted, animate-pulse and the like)
- matching the ratio of the real photos: that is the whole point of a proportional skeleton
- the grid on an inner element: a container query does not apply to the container itself
- the staggered shimmer — a simultaneous flash reads as the screen blinking
- role="status" and aria-busy: without them the loading state does not exist for a screen reader
- the prefers-reduced-motion rule that kills the shimmer
## 6. You may change
- ratio — the proportion of the coming photos
- count — how many placeholders to show
- label — what is loading
- width and outer spacing through className
## 7. Rules
- The placeholder count should match the expected photo count: six tiles before two images reads as a bug.
- Do not leave the skeleton as the only answer for more than a couple of seconds: long loads need progress or an explanation.
- The shimmer delays are written for six tiles; for more, add nth-child rules in your copy.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/aspect-008.jsonhttps://vibeui.ru/r/aspect-008.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-aspect-008-*. Сетка живёт на внутреннем элементе, потому что корень объявлен контейнером. Соотношение задаётся один раз переменной и применяется ко всем плиткам. Блик идёт по градиенту с задержкой по плиткам: одновременная вспышка выглядит как мигание экрана. Контейнер объявлен role="status" с aria-busy.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Aspect008Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
ratio?: string
/** Сколько кадров показывать: сетка заглушек под будущую галерею. */
count?: number
label?: string
}
// Идея компонента: заглушка галереи, которая занимает ровно то место, что
// займут будущие кадры. Соотношение задаётся один раз и передаётся всем
// плиткам, поэтому при загрузке страница не прыгает — это и есть смысл
// заглушки с пропорцией, в отличие от серого прямоугольника наугад.
const STYLES = `
:where([data-vibeui-block="aspect-008"]){
--vibeui-aspect-008-ratio:4 / 3;
--vibeui-aspect-008-base:oklch(0.93 0.005 265);
--vibeui-aspect-008-shine:oklch(0.97 0.003 265);
--vibeui-aspect-008-fg:oklch(0.55 0.014 265);
--vibeui-aspect-008-radius:0.75rem;
--vibeui-aspect-008-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="aspect-008"]{display:block;width:100%;box-sizing:border-box;font-family:var(--vibeui-aspect-008-font)}
/* Раскладка живёт на внутренней рамке, а не на корне: контейнерный запрос
применяется к потомкам контейнера, но не к нему самому. */
[data-vibeui-block="aspect-008"] [data-part="grid"]{
display:grid;gap:0.625rem;grid-template-columns:repeat(2,1fr);
}
[data-vibeui-block="aspect-008"] [data-part="tile"]{
position:relative;overflow:hidden;
aspect-ratio:var(--vibeui-aspect-008-ratio);
border-radius:var(--vibeui-aspect-008-radius);
background:
linear-gradient(90deg,var(--vibeui-aspect-008-base) 0%,var(--vibeui-aspect-008-shine) 50%,var(--vibeui-aspect-008-base) 100%)
0 0 / 200% 100%;
animation:vibeui-aspect-008-sweep 1.4s ease-in-out infinite;
}
/* Задержка по плиткам: одновременная вспышка выглядит как мигание экрана. */
[data-vibeui-block="aspect-008"] [data-part="tile"]:nth-child(2){animation-delay:.12s}
[data-vibeui-block="aspect-008"] [data-part="tile"]:nth-child(3){animation-delay:.24s}
[data-vibeui-block="aspect-008"] [data-part="tile"]:nth-child(4){animation-delay:.36s}
[data-vibeui-block="aspect-008"] [data-part="tile"]:nth-child(5){animation-delay:.48s}
[data-vibeui-block="aspect-008"] [data-part="tile"]:nth-child(6){animation-delay:.6s}
/* Значок кадра: две фигуры, как в пустом слоте галереи. */
[data-vibeui-block="aspect-008"] [data-part="tile"]::after{
content:"";position:absolute;left:50%;top:50%;
width:1.5rem;height:1.125rem;margin:-0.5625rem 0 0 -0.75rem;
border:1.5px solid var(--vibeui-aspect-008-fg);border-radius:0.25rem;opacity:.35;
}
@keyframes vibeui-aspect-008-sweep{
0%{background-position:120% 0}
100%{background-position:-20% 0}
}
@container (min-width: 30rem){
[data-vibeui-block="aspect-008"] [data-part="grid"]{grid-template-columns:repeat(3,1fr)}
}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="aspect-008"] *{animation:none!important;transition:none!important}
[data-vibeui-block="aspect-008"] [data-part="tile"]{background:var(--vibeui-aspect-008-base)}
}
`
/**
* Заглушка галереи: кадры занимают то же место, что займут снимки.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Aspect008({
ratio = "4 / 3",
count = 6,
label = "Загружаются снимки",
className,
style,
...props
}: Aspect008Props) {
const palette = {
"--vibeui-aspect-008-ratio": ratio,
...style,
} as CSSProperties
return (
<>
<style href="vibeui-aspect-008" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="aspect-008"
role="status"
aria-busy="true"
aria-label={label}
className={className}
style={palette}
>
<div data-part="grid">
{Array.from({ length: Math.max(1, count) }, (_, index) => (
<div key={index} data-part="tile" />
))}
</div>
</div>
</>
)
}