2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Modules

MediaUpload

Updated: May 14, 2025
View on GitHub
A versatile component for uploading and previewing images. MediaUpload provides a drag-and-drop interface with built-in image compression and preview capabilities. MediaUpload supports different aspect ratios to accommodate various design requirements. Display an initial preview image by setting the initialPreviewImage prop. Customize the empty state message with the emptyState prop. Show a loading spinner while processing uploads. Handle uploaded files with the onFileUpload callback. By default, MediaUpload compresses images before uploading. You can customize the compression settings or disable it entirely. The MediaUpload uses compressorjs under the hood and compresses images client side.
Prop
Type
Default
onFileUpload
(file: File) => Promise<void>
compress
truefalse
true
aspectRatio
string'16 / 9'
initialPreviewImage
stringnull
null
emptyState
React.ReactNode'Drag and drop or click to browse'
quality
number0.8
sizes
string
convertTypes
string[]['image/png', 'image/webp', 'image/jpg']
resizeMaxWidth
number1920
resizeMaxHeight
number1920
resizeWidth
number1200
resizeHeight
number1200
loading
truefalse
false
accept
string'image/*'
children
React.ReactNode
…and every FlexProps propinherited
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club