--- title: MediaFile description: |- The `MediaFile` component renders the media for the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop. api_version: 2025-04 api_name: hydrogen-react source_url: html: https://shopify.dev/docs/api/hydrogen-react/latest/components/mediafile md: https://shopify.dev/docs/api/hydrogen-react/latest/components/mediafile.md --- # Media​Filecomponent The `MediaFile` component renders the media for the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop. ## Props MediaFile renders an `Image`, `Video`, `ExternalVideo`, or `ModelViewer` component. Use the `mediaOptions` prop to customize the props sent to each of these components. * data PartialDeep\ required An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). * about string | undefined * accessKey string | undefined * aria-activedescendant string | undefined Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. * aria-atomic Booleanish | undefined Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. * aria-autocomplete 'none' | 'inline' | 'list' | 'both' | undefined Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made. * aria-braillelabel string | undefined Defines a string value that labels the current element, which is intended to be converted into Braille. * aria-brailleroledescription string | undefined Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. * aria-busy Booleanish | undefined * aria-checked boolean | 'false' | 'mixed' | 'true' | undefined Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * aria-colcount number | undefined Defines the total number of columns in a table, grid, or treegrid. * aria-colindex number | undefined Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. * aria-colindextext string | undefined Defines a human readable text alternative of aria-colindex. * aria-colspan number | undefined Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. * aria-controls string | undefined Identifies the element (or elements) whose contents or presence are controlled by the current element. * aria-current boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined Indicates the element that represents the current item within a container or set of related elements. * aria-describedby string | undefined Identifies the element (or elements) that describes the object. * aria-description string | undefined Defines a string value that describes or annotates the current element. * aria-details string | undefined Identifies the element that provides a detailed, extended description for the object. * aria-disabled Booleanish | undefined Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * aria-errormessage string | undefined Identifies the element that provides an error message for the object. * aria-expanded Booleanish | undefined Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. * aria-flowto string | undefined Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order. * aria-haspopup boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. * aria-hidden Booleanish | undefined Indicates whether the element is exposed to an accessibility API. * aria-invalid boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined Indicates the entered value does not conform to the format expected by the application. * aria-keyshortcuts string | undefined Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. * aria-label string | undefined Defines a string value that labels the current element. * aria-labelledby string | undefined Identifies the element (or elements) that labels the current element. * aria-level number | undefined Defines the hierarchical level of an element within a structure. * aria-live 'off' | 'assertive' | 'polite' | undefined Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. * aria-modal Booleanish | undefined Indicates whether an element is modal when displayed. * aria-multiline Booleanish | undefined Indicates whether a text box accepts multiple lines of input or only a single line. * aria-multiselectable Booleanish | undefined Indicates that the user may select more than one item from the current selectable descendants. * aria-orientation 'horizontal' | 'vertical' | undefined Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. * aria-owns string | undefined Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship. * aria-placeholder string | undefined Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format. * aria-posinset number | undefined Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * aria-pressed boolean | 'false' | 'mixed' | 'true' | undefined Indicates the current "pressed" state of toggle buttons. * aria-readonly Booleanish | undefined Indicates that the element is not editable, but is otherwise operable. * aria-relevant 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * aria-required Booleanish | undefined Indicates that user input is required on the element before a form may be submitted. * aria-roledescription string | undefined Defines a human-readable, author-localized description for the role of an element. * aria-rowcount number | undefined Defines the total number of rows in a table, grid, or treegrid. * aria-rowindex number | undefined Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. * aria-rowindextext string | undefined Defines a human readable text alternative of aria-rowindex. * aria-rowspan number | undefined Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. * aria-selected Booleanish | undefined Indicates the current "selected" state of various widgets. * aria-setsize number | undefined Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * aria-sort 'none' | 'ascending' | 'descending' | 'other' | undefined Indicates if items in a table or grid are sorted in ascending or descending order. * aria-valuemax number | undefined Defines the maximum allowed value for a range widget. * aria-valuemin number | undefined Defines the minimum allowed value for a range widget. * aria-valuenow number | undefined Defines the current value for a range widget. * aria-valuetext string | undefined Defines the human readable text alternative of aria-valuenow for a range widget. * autoCapitalize string | undefined * autoCorrect string | undefined * autoFocus boolean | undefined * autoSave string | undefined * children ReactNode | undefined * className string | undefined * color string | undefined * content string | undefined * contentEditable Booleanish | "inherit" | undefined * contextMenu string | undefined * dangerouslySetInnerHTML { // Should be InnerHTML\['innerHTML']. // But unfortunately we're mixing renderer-specific type declarations. \_\_html: string | TrustedHTML; } | undefined * datatype string | undefined * defaultChecked boolean | undefined * defaultValue string | number | ReadonlyArray\ | undefined * dir string | undefined * draggable Booleanish | undefined * hidden boolean | undefined * id string | undefined * inlist any * inputMode 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined Hints at the type of data that might be entered by the user while editing the element or its contents * is string | undefined Specify that a standard HTML element should behave like a defined custom built-in element * itemID string | undefined * itemProp string | undefined * itemRef string | undefined * itemScope boolean | undefined * itemType string | undefined * lang string | undefined * mediaOptions MediaOptions The options for the `Image`, `Video`, `ExternalVideo`, or `ModelViewer` components. * nonce string | undefined * onAbort ReactEventHandler\ | undefined * onAbortCapture ReactEventHandler\ | undefined * onAnimationEnd AnimationEventHandler\ | undefined * onAnimationEndCapture AnimationEventHandler\ | undefined * onAnimationIteration AnimationEventHandler\ | undefined * onAnimationIterationCapture AnimationEventHandler\ | undefined * onAnimationStart AnimationEventHandler\ | undefined * onAnimationStartCapture AnimationEventHandler\ | undefined * onAuxClick MouseEventHandler\ | undefined * onAuxClickCapture MouseEventHandler\ | undefined * onBeforeInput FormEventHandler\ | undefined * onBeforeInputCapture FormEventHandler\ | undefined * onBlur FocusEventHandler\ | undefined * onBlurCapture FocusEventHandler\ | undefined * onCanPlay ReactEventHandler\ | undefined * onCanPlayCapture ReactEventHandler\ | undefined * onCanPlayThrough ReactEventHandler\ | undefined * onCanPlayThroughCapture ReactEventHandler\ | undefined * onChange FormEventHandler\ | undefined * onChangeCapture FormEventHandler\ | undefined * onClick MouseEventHandler\ | undefined * onClickCapture MouseEventHandler\ | undefined * onCompositionEnd CompositionEventHandler\ | undefined * onCompositionEndCapture CompositionEventHandler\ | undefined * onCompositionStart CompositionEventHandler\ | undefined * onCompositionStartCapture CompositionEventHandler\ | undefined * onCompositionUpdate CompositionEventHandler\ | undefined * onCompositionUpdateCapture CompositionEventHandler\ | undefined * onContextMenu MouseEventHandler\ | undefined * onContextMenuCapture MouseEventHandler\ | undefined * onCopy ClipboardEventHandler\ | undefined * onCopyCapture ClipboardEventHandler\ | undefined * onCut ClipboardEventHandler\ | undefined * onCutCapture ClipboardEventHandler\ | undefined * onDoubleClick MouseEventHandler\ | undefined * onDoubleClickCapture MouseEventHandler\ | undefined * onDrag DragEventHandler\ | undefined * onDragCapture DragEventHandler\ | undefined * onDragEnd DragEventHandler\ | undefined * onDragEndCapture DragEventHandler\ | undefined * onDragEnter DragEventHandler\ | undefined * onDragEnterCapture DragEventHandler\ | undefined * onDragExit DragEventHandler\ | undefined * onDragExitCapture DragEventHandler\ | undefined * onDragLeave DragEventHandler\ | undefined * onDragLeaveCapture DragEventHandler\ | undefined * onDragOver DragEventHandler\ | undefined * onDragOverCapture DragEventHandler\ | undefined * onDragStart DragEventHandler\ | undefined * onDragStartCapture DragEventHandler\ | undefined * onDrop DragEventHandler\ | undefined * onDropCapture DragEventHandler\ | undefined * onDurationChange ReactEventHandler\ | undefined * onDurationChangeCapture ReactEventHandler\ | undefined * onEmptied ReactEventHandler\ | undefined * onEmptiedCapture ReactEventHandler\ | undefined * onEncrypted ReactEventHandler\ | undefined * onEncryptedCapture ReactEventHandler\ | undefined * onEnded ReactEventHandler\ | undefined * onEndedCapture ReactEventHandler\ | undefined * onError ReactEventHandler\ | undefined * onErrorCapture ReactEventHandler\ | undefined * onFocus FocusEventHandler\ | undefined * onFocusCapture FocusEventHandler\ | undefined * onGotPointerCapture PointerEventHandler\ | undefined * onGotPointerCaptureCapture PointerEventHandler\ | undefined * onInput FormEventHandler\ | undefined * onInputCapture FormEventHandler\ | undefined * onInvalid FormEventHandler\ | undefined * onInvalidCapture FormEventHandler\ | undefined * onKeyDown KeyboardEventHandler\ | undefined * onKeyDownCapture KeyboardEventHandler\ | undefined * onKeyUp KeyboardEventHandler\ | undefined * onKeyUpCapture KeyboardEventHandler\ | undefined * onLoad ReactEventHandler\ | undefined * onLoadCapture ReactEventHandler\ | undefined * onLoadedData ReactEventHandler\ | undefined * onLoadedDataCapture ReactEventHandler\ | undefined * onLoadedMetadata ReactEventHandler\ | undefined * onLoadedMetadataCapture ReactEventHandler\ | undefined * onLoadStart ReactEventHandler\ | undefined * onLoadStartCapture ReactEventHandler\ | undefined * onLostPointerCapture PointerEventHandler\ | undefined * onLostPointerCaptureCapture PointerEventHandler\ | undefined * onMouseDown MouseEventHandler\ | undefined * onMouseDownCapture MouseEventHandler\ | undefined * onMouseEnter MouseEventHandler\ | undefined * onMouseLeave MouseEventHandler\ | undefined * onMouseMove MouseEventHandler\ | undefined * onMouseMoveCapture MouseEventHandler\ | undefined * onMouseOut MouseEventHandler\ | undefined * onMouseOutCapture MouseEventHandler\ | undefined * onMouseOver MouseEventHandler\ | undefined * onMouseOverCapture MouseEventHandler\ | undefined * onMouseUp MouseEventHandler\ | undefined * onMouseUpCapture MouseEventHandler\ | undefined * onPaste ClipboardEventHandler\ | undefined * onPasteCapture ClipboardEventHandler\ | undefined * onPause ReactEventHandler\ | undefined * onPauseCapture ReactEventHandler\ | undefined * onPlay ReactEventHandler\ | undefined * onPlayCapture ReactEventHandler\ | undefined * onPlaying ReactEventHandler\ | undefined * onPlayingCapture ReactEventHandler\ | undefined * onPointerCancel PointerEventHandler\ | undefined * onPointerCancelCapture PointerEventHandler\ | undefined * onPointerDown PointerEventHandler\ | undefined * onPointerDownCapture PointerEventHandler\ | undefined * onPointerEnter PointerEventHandler\ | undefined * onPointerEnterCapture PointerEventHandler\ | undefined * onPointerLeave PointerEventHandler\ | undefined * onPointerLeaveCapture PointerEventHandler\ | undefined * onPointerMove PointerEventHandler\ | undefined * onPointerMoveCapture PointerEventHandler\ | undefined * onPointerOut PointerEventHandler\ | undefined * onPointerOutCapture PointerEventHandler\ | undefined * onPointerOver PointerEventHandler\ | undefined * onPointerOverCapture PointerEventHandler\ | undefined * onPointerUp PointerEventHandler\ | undefined * onPointerUpCapture PointerEventHandler\ | undefined * onProgress ReactEventHandler\ | undefined * onProgressCapture ReactEventHandler\ | undefined * onRateChange ReactEventHandler\ | undefined * onRateChangeCapture ReactEventHandler\ | undefined * onReset FormEventHandler\ | undefined * onResetCapture FormEventHandler\ | undefined * onResize ReactEventHandler\ | undefined * onResizeCapture ReactEventHandler\ | undefined * onScroll UIEventHandler\ | undefined * onScrollCapture UIEventHandler\ | undefined * onSeeked ReactEventHandler\ | undefined * onSeekedCapture ReactEventHandler\ | undefined * onSeeking ReactEventHandler\ | undefined * onSeekingCapture ReactEventHandler\ | undefined * onSelect ReactEventHandler\ | undefined * onSelectCapture ReactEventHandler\ | undefined * onStalled ReactEventHandler\ | undefined * onStalledCapture ReactEventHandler\ | undefined * onSubmit FormEventHandler\ | undefined * onSubmitCapture FormEventHandler\ | undefined * onSuspend ReactEventHandler\ | undefined * onSuspendCapture ReactEventHandler\ | undefined * onTimeUpdate ReactEventHandler\ | undefined * onTimeUpdateCapture ReactEventHandler\ | undefined * onTouchCancel TouchEventHandler\ | undefined * onTouchCancelCapture TouchEventHandler\ | undefined * onTouchEnd TouchEventHandler\ | undefined * onTouchEndCapture TouchEventHandler\ | undefined * onTouchMove TouchEventHandler\ | undefined * onTouchMoveCapture TouchEventHandler\ | undefined * onTouchStart TouchEventHandler\ | undefined * onTouchStartCapture TouchEventHandler\ | undefined * onTransitionEnd TransitionEventHandler\ | undefined * onTransitionEndCapture TransitionEventHandler\ | undefined * onVolumeChange ReactEventHandler\ | undefined * onVolumeChangeCapture ReactEventHandler\ | undefined * onWaiting ReactEventHandler\ | undefined * onWaitingCapture ReactEventHandler\ | undefined * onWheel WheelEventHandler\ | undefined * onWheelCapture WheelEventHandler\ | undefined * placeholder string | undefined * prefix string | undefined * property string | undefined * radioGroup string | undefined * rel string | undefined * resource string | undefined * results number | undefined * rev string | undefined * role AriaRole | undefined * security string | undefined * slot string | undefined * spellCheck Booleanish | undefined * style CSSProperties | undefined * suppressContentEditableWarning boolean | undefined * suppressHydrationWarning boolean | undefined * tabIndex number | undefined * title string | undefined * translate 'yes' | 'no' | undefined * typeof string | undefined * unselectable 'on' | 'off' | undefined * vocab string | undefined * aria-dropeffect 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined deprecated Indicates what functions can be performed when a dragged object is released on the drop target. Deprecated in ARIA 1.1 * aria-grabbed Booleanish | undefined deprecated Indicates an element's "grabbed" state in a drag-and-drop operation. Deprecated in ARIA 1.1 * onKeyPress KeyboardEventHandler\ | undefined deprecated Deprecated Deprecated * onKeyPressCapture KeyboardEventHandler\ | undefined deprecated Deprecated Deprecated ### MediaOptions * externalVideo Props that will only apply when an \`\\` is rendered ```ts Omit< React.ComponentProps['options'], 'data' > ``` * image Props that will only apply when an \`\\` is rendered ```ts Omit ``` * modelViewer Props that will only apply when a \`\\` is rendered ```ts Omit ``` * video Props that will only apply when a \`\