Aspect Ratio

Product Frame

A square product frame: in a shop grid the cards must share one height while the photos differ — a square crops them predictably.

  • aspect ratio
  • product
  • commerce
  • grid

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/aspect-003?lang=en

−30 %
Flight desk lamp, warm light€496 900 ₽
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-003" (Product Frame) 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-003.json

Registry item: https://vibeui.ru/r/aspect-003.json
Installs to: components/vibeui/aspect-003.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 square product frame: in a shop grid the cards must share one height while the photos differ — a square crops them predictably.

A product card with a square frame: a discount pill in the corner, a two-line title, the price and a struck-through old price beneath. The whole card follows a single link. Zero dependencies, one file, its own palette.

## 3. How to use it
import { Aspect003 } from "@/components/vibeui/aspect-003"

<Aspect003
  title="Flight desk lamp"
  price="€49"
  oldPrice="€69"
  badge="−30 %"
/>

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-003-* palette — do not swap it for your theme tokens
- the square: in a shop grid the cards must share a height across different photos
- the price under the frame rather than over it: over a light photo it cannot be read
- clamping the title to two lines — a long name otherwise breaks the row
- the struck-through old price kept muted: next to the new one it is only for comparison
- the stretched ::after link: in a grid of forty products extra links get in the way

## 6. You may change
- the title, price, oldPrice and badge copy
- href — the product page
- the accent through the accent prop — the discount pill colour
- the photo: put an <img> inside [data-part="frame"]

## 7. Rules
- The price is a string: formatting and currency belong to the caller.
- Do not show an old price without a discount: a struck-through figure with no saving reads as a trick.
- The pill fits short text — "−30 %", "Top" — not an offer.
- 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-003.json
https://vibeui.ru/r/aspect-003.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-aspect-003-*. Кадр держит 1:1, плашка со скидкой лежит в его углу, название обрезается двумя строками, цена и зачёркнутая старая цена стоят под кадром. Ссылка названия растягивается на всю карточку через ::after, поэтому в сетке остаётся одна ссылка на товар.

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 Aspect003Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "title" | "children"
> & {
  title?: string
  price?: string
  oldPrice?: string
  /** Плашка в углу: «−30 %», «Хит», «Нет в наличии». */
  badge?: string
  href?: string
  accent?: string
}

// Идея компонента: квадратный кадр товара. Квадрат выбран не из вкуса: в
// сетке магазина карточки должны быть одной высоты, а фотографии товаров
// приходят разные — квадрат обрезает их предсказуемо. Цена стоит под кадром,
// а не поверх: поверх её не прочитать на светлой фотографии.
const STYLES = `
:where([data-vibeui-block="aspect-003"]){
--vibeui-aspect-003-fg:oklch(0.22 0.014 265);
--vibeui-aspect-003-muted:oklch(0.52 0.014 265);
--vibeui-aspect-003-bg:oklch(1 0 0);
--vibeui-aspect-003-frame:oklch(0.955 0.006 265);
--vibeui-aspect-003-border:oklch(0.91 0.006 265);
--vibeui-aspect-003-accent:oklch(0.56 0.19 25);
--vibeui-aspect-003-radius:0.875rem;
--vibeui-aspect-003-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Карточка несёт собственную светлую подложку: она обязана читаться и на
   тёмной странице, где её текст иначе сливается с фоном. */
[data-vibeui-block="aspect-003"]{
position:relative;display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:16rem;box-sizing:border-box;padding:0.75rem;
background:var(--vibeui-aspect-003-bg);
border:1px solid var(--vibeui-aspect-003-border);
border-radius:calc(var(--vibeui-aspect-003-radius) + 0.25rem);
color:var(--vibeui-aspect-003-fg);font-family:var(--vibeui-aspect-003-font);
}
/* Квадрат: в сетке магазина карточки обязаны быть одной высоты. */
[data-vibeui-block="aspect-003"] [data-part="frame"]{
position:relative;aspect-ratio:1 / 1;overflow:hidden;
border:1px solid var(--vibeui-aspect-003-border);
border-radius:var(--vibeui-aspect-003-radius);
background:
radial-gradient(90% 80% at 30% 20%,oklch(1 0 0),transparent 70%),
var(--vibeui-aspect-003-frame);
}
[data-vibeui-block="aspect-003"] [data-part="frame"] img{display:block;width:100%;height:100%;object-fit:cover}
[data-vibeui-block="aspect-003"] [data-part="badge"]{
position:absolute;left:0.625rem;top:0.625rem;
padding:0.1875rem 0.4375rem;border-radius:0.375rem;
background:var(--vibeui-aspect-003-accent);color:oklch(0.99 0.01 25);
font-size:0.6875rem;font-weight:700;font-variant-numeric:tabular-nums;
}
[data-vibeui-block="aspect-003"] [data-part="title"]{
font-size:0.875rem;line-height:1.35;
display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
[data-vibeui-block="aspect-003"] a{color:inherit;text-decoration:none}
[data-vibeui-block="aspect-003"] a::after{content:"";position:absolute;inset:0;border-radius:inherit}
[data-vibeui-block="aspect-003"] a:focus-visible{outline:2px solid var(--vibeui-aspect-003-accent);outline-offset:3px;border-radius:0.375rem}
[data-vibeui-block="aspect-003"] [data-part="prices"]{display:flex;align-items:baseline;gap:0.5rem}
[data-vibeui-block="aspect-003"] [data-part="price"]{font-size:1rem;font-weight:650;font-variant-numeric:tabular-nums}
/* Старая цена зачёркнута и приглушена: рядом с новой её только сравнивают. */
[data-vibeui-block="aspect-003"] [data-part="old"]{
font-size:0.8125rem;color:var(--vibeui-aspect-003-muted);
text-decoration:line-through;font-variant-numeric:tabular-nums;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="aspect-003"] *{animation:none!important;transition:none!important}}
`

/**
 * Квадратный кадр товара: предсказуемая обрезка и цена под ним.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Aspect003({
  title = "Настольная лампа «Полёт», тёплый свет",
  price = "4 900 ₽",
  oldPrice = "6 900 ₽",
  badge = "−30 %",
  href = "#",
  accent,
  className,
  style,
  ...props
}: Aspect003Props) {
  const palette = {
    ...(accent ? { "--vibeui-aspect-003-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-aspect-003" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="aspect-003"
        className={className}
        style={palette}
      >
        <div data-part="frame">
          {badge ? <span data-part="badge">{badge}</span> : null}
        </div>
        <span data-part="title">
          {href ? <a href={href}>{title}</a> : title}
        </span>
        <span data-part="prices">
          <span data-part="price">{price}</span>
          {oldPrice ? <span data-part="old">{oldPrice}</span> : null}
        </span>
      </div>
    </>
  )
}