ValyroUI English version

Image Cropper

Кадрирование: сдвиг, масштаб, поворот, пропорции и круглый аватар. Pro · Формы и ввод › Файлы и изображения

Установка

npx valyro-cli@latest login
npx valyro-cli@latest add image-cropper
npm install valyro-ui-pro

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

Пропсы

PropTypeDefault
srcstring | nullImage URL (an object URL or data URL works without CORS). Nothing is shown while empty.
altstring''Alt text of the image being cropped; empty marks it decorative.
aspectnumber1Width / height of the crop (default 1).
shape'rect' | 'circle''rect'circle for avatars: the crop is still a square area; mask the result with getCroppedBlob(…, { shape: 'circle' }).
zoomnumberControlled zoom; use with onZoomChange.
defaultZoomnumber1Initial zoom when uncontrolled.
onZoomChange(zoom: number) => voidCalled with the new zoom when it changes.
minZoomnumber1Lowest zoom of the slider, wheel and pinch; 1 is the image just covering the crop frame.
maxZoomnumber4Highest zoom of the slider, wheel and pinch, relative to the image just covering the crop frame.
rotationnumberDegrees, clockwise.
defaultRotationnumber0Initial rotation when uncontrolled.
onRotationChange(rotation: number) => voidCalled with the new rotation when it changes.
gridboolean | 'interaction''interaction'Rule-of-thirds grid: always, never, or while moving the image (default).
heightnumber | string320Height of the crop stage (default 320px).
controlsbooleantrueZoom slider and rotate button under the image (default true).
onCropChange(area: CropArea, percent: CropArea) => voidEvery change of the crop, while it happens.
onCropComplete(area: CropArea, percent: CropArea) => voidThe crop after an interaction ends (and once the image loads): area in px of the rotated image, and in percent.
labelsPartial<ImageCropperLabels>Overrides for the built-in English text; keys left out keep their defaults.

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

  • File Uploader — Загрузка файлов
  • Text Input — Текстовые поля
  • Textarea — Многострочный ввод
  • Search Input — Поисковая строка
  • Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
  • Tags Input — Ввод тегов
  • Select — Выбор из списка
  • Multi Select — Множественный выбор
  • Combobox — Поиск и выбор
  • Listbox — Список вариантов на странице: один или несколько, диапазоны с Shift
  • Chip Group — Группа чипов с иконками: один или несколько вариантов
  • Checkbox Tree — Дерево с чекбоксами: каскад, частичная отметка, клавиатура

Назад: File Uploader · Далее: Form Field · Весь раздел «Формы и ввод»