Title: ResponsiveWrapper
Published: March 9, 2021
Last modified: October 14, 2026

---

# ResponsiveWrapper

## In this article

 * [Usage](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#usage)
    - [Usage with SVG elements](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#usage-with-svg-elements)
 * [Props](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#props)
    - [children: React.ReactElement](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#children-react-reactelement)
    - [isInline: boolean](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#isinline-boolean)
    - [naturalHeight: number](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#naturalheight-number)
    - [naturalWidth: number](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#naturalwidth-number)

This component is deprecated. Use the CSS `aspect-ratio` property instead.

A wrapper component that maintains its aspect ratio when resized.

## 󠀁[Usage](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#usage)󠁿

    ```language-jsx
    import { ResponsiveWrapper } from '@wordpress/components';

    const MyResponsiveWrapper = () => (
        <ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>
            <img
                src="https://s.w.org/style/images/about/WordPress-logotype-standard.png"
                alt="WordPress"
            />
        </ResponsiveWrapper>
    );
    ```

### 󠀁[Usage with SVG elements](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#usage-with-svg-elements)󠁿

When passing an `SVG` element as the `<ResponsiveWrapper />`‘s child, make sure 
that it has the `viewbox` and the `preserveAspectRatio` set.

When dealing with SVGs, it may not be possible to derive its `naturalWidth` and `
naturalHeight` and therefore passing them as propertied to `<ResponsiveWrapper /
>`. In this case, the SVG simply keeps scaling up to fill its container, unless 
the `height` and `width` attributes are specified.

## 󠀁[Props](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#props)󠁿

### 󠀁[children: React.ReactElement](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#children-react-reactelement)󠁿

The element to wrap.

 * Required: Yes

### 󠀁[isInline: boolean](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#isinline-boolean)󠁿

If true, the wrapper will be `span` instead of `div`.

 * Required: No
 * Default: `false`

### 󠀁[naturalHeight: number](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#naturalheight-number)󠁿

The intrinsic height of the element to wrap. Will be used to determine the aspect
ratio.

 * Required: No

### 󠀁[naturalWidth: number](https://developer.wordpress.org/block-editor/reference-guides/components/responsive-wrapper/?output_format=md#naturalwidth-number)󠁿

The intrinsic width of the element to wrap. Will be used to determine the aspect
ratio.

 * Required: No

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: ResponsiveWrapper ](https://github.com/WordPress/gutenberg/edit/trunk/packages/components/src/responsive-wrapper/README.md)

[  Previous: ResizeTooltip](https://developer.wordpress.org/block-editor/reference-guides/components/resize-tooltip/)

[  Next: Sandbox](https://developer.wordpress.org/block-editor/reference-guides/components/sandbox/)