ValyroUI English version

Image

Картинки без сдвига вёрстки: заглушка, мягкое появление, запасной вариант, источник для тёмной темы. Бесплатно, MIT · Данные и показатели › Карточки

Установка

npx valyro-cli@latest add image
npx shadcn@latest add https://valyro.xyz/r/image.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Image } from 'valyro-ui';

Пропсы

PropTypeDefault
src *stringThe picture. An empty string keeps the placeholder up (the address is still on its way).
alt *stringText alternative; "" marks a decorative picture.
srcDarkstringSource for dark mode: follows the colour scheme of the nearest ThemeProvider / ThemeScope, cross-fading on a switch.
srcSetstringResponsive candidates for src (not for srcDark).
sizesstringLayout widths for srcSet.
widthnumberIntrinsic width in px: with height, reserves the box before the picture arrives.
heightnumberIntrinsic height in px.
aspectRationumber | stringReserves the box before load so nothing below moves, e.g. "16/9" or 1.5.
fit'cover' | 'contain' | 'fill' | 'none' | 'scale-down''cover'How the picture fills the reserved box (object-fit).
placeholder'shimmer' | 'color' | 'blur' | 'none' | ReactNode'shimmer'What shows while loading: a moving sheen, a plain fill, a blurred preview (blurDataURL), nothing, or your node.
blurDataURLstringA tiny data URL shown blurred while the picture loads (placeholder="blur").
fallbackReactNode | stringShown when the picture fails: a string is tried once as another source; a node is shown as is. Default: an image icon.
prioritybooleanfalseAbove the fold: loads eagerly at high priority and appears without a fade.
loading'lazy' | 'eager'Native lazy loading (default lazy, eager with priority).
crossOrigin'anonymous' | 'use-credentials' | ''CORS mode of the request.
referrerPolicyComponentPropsWithRef<'img'>['referrerPolicy']Referrer sent with the request.
imgRefRef<HTMLImageElement>Ref to the <img> element on screen (ref is the wrapper's).
onStatusChange(status: ImageStatus) => voidCalled when the picture starts loading, appears or fails.
labelsPartial<ImageLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Card — Универсальные карточки
  • Item Card — Карточка-строка: иконка, заголовок, описание и элемент управления справа
  • Record Card — Карточка записи: статус, контекст, ключевые поля и действия
  • Carousel — Карусель: scroll-snap, свайп, автопрокрутка, миниатюры
  • Empty State — Экран отсутствия данных
  • Data Table — Таблицы с поиском и сортировкой
  • Data Grid — Таблица на 100 000 строк: группировка, фильтры, редактирование
  • Virtual List — Виртуальный список на 100 000 строк
  • Bulk Action Bar — Панель действий над выбранными строками с горячими клавишами
  • List Block — Блок списка с картинками или иконками, описанием и значением
  • Description List — Список «ключ — значение»: столбиком, строками или сеткой с иконками
  • Tree View — Древовидные структуры

Назад: Record Card · Далее: Carousel · Весь раздел «Данные и показатели»