Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow AvatarUpload Component

From Leeroopedia
Knowledge Sources
Domains Frontend, UI_Components
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete React component for image upload with drag-to-crop functionality and base64 conversion provided by the RAGFlow frontend.

Description

The AvatarUpload component provides an image upload widget with canvas-based cropping. It uses a forwardRef pattern for external input control, supports base64 encoding, and includes a visual crop overlay with drag-and-resize functionality.

Usage

Import this component when building profile or entity creation forms that require avatar/image upload with cropping capabilities.

Code Reference

Source Location

Signature

export interface AvatarUploadProps {
  value?: string;
  onChange?: (value: string) => void;
  tips?: string;
}

export const AvatarUpload = forwardRef<HTMLInputElement, AvatarUploadProps>(
  function AvatarUpload({ value, onChange, tips }, ref)
)

Import

import { AvatarUpload } from '@/components/avatar-upload';

I/O Contract

Inputs

Name Type Required Description
value string No Current avatar image as base64 string
onChange function No Callback when cropped image is produced
tips string No Helper text displayed below upload area

Outputs

Name Type Description
onChange callback string Base64-encoded cropped image data

Usage Examples

import { AvatarUpload } from '@/components/avatar-upload';

function ProfileForm() {
  const [avatar, setAvatar] = useState('');

  return (
    <AvatarUpload
      value={avatar}
      onChange={setAvatar}
      tips="Upload a profile photo"
    />
  );
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment