Skip to main content

MultinaireMediaPickerButton

Image/media picker button with preview and aspect ratio support.

Basic Usage

import { MultinaireMediaPickerButton } from '@multinaire/multinaire-design';

<MultinaireMediaPickerButton
placeholder="Select image"
value={imageSource}
onPress={() => pickImage()}
/>

Props

PropTypeDefaultDescription
placeholderstringPlaceholder text shown when the field is empty
valueImageSourcePropTypeCurrently selected image source
titlestringField label displayed above the input
requiredbooleanfalseMark the field as required. Displays a visual indicator
placeholderIconIconNameFallback icon shown when no media is selected
aspectRatio'1:1' | '16:9' | '9:16''1:1'Aspect ratio of the media preview
extraReactElementExtra element rendered at the trailing end of the label row (e.g. a "Forgot password?" link)
errorTextstringError message displayed below the input
clearTextstringLabel for the clear action button
flexnumberFlex grow value
marginSpacingPropsOuter margin
isLoadingbooleanfalseShow a loading state while the media is uploading or processing
onPress() => voidPress handler that opens the media picker
onClear() => voidCallback invoked when the user removes the selected media

Examples

Profile Photo Picker

<MultinaireMediaPickerButton
title="Profile Photo"
placeholder="Add photo"
placeholderIcon="Camera"
value={profileImage}
aspectRatio="1:1"
onPress={pickProfilePhoto}
onClear={() => setProfileImage(null)}
clearText="Remove"
/>

Cover Image Picker

<MultinaireMediaPickerButton
title="Cover Image"
placeholder="Add cover image"
value={coverImage}
aspectRatio="16:9"
onPress={pickCoverImage}
/>

Story Image Picker

<MultinaireMediaPickerButton
placeholder="Add story"
value={storyImage}
aspectRatio="9:16"
onPress={pickStoryImage}
/>

With Loading State

<MultinaireMediaPickerButton
title="Upload Image"
placeholder="Select image"
value={image}
isLoading={isUploading}
onPress={pickAndUploadImage}
/>

With Validation

<MultinaireMediaPickerButton
title="ID Document"
required
placeholder="Upload ID"
value={idDocument}
errorText={!idDocument ? 'ID document is required' : undefined}
onPress={pickIdDocument}
/>