Responsive
Aspect-ratio container that constrains its content to a fixed ratio using a sizer trick. Supports dimension overrides and standard spacing props.
Preview
Rendering the live preview…
16/9Rendering the live preview…
4/3Rendering the live preview…
1/1Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-responsive> — 3 parts: root container ①, sizer div ② (drives padding-block-end aspect trick), and content div ③.- 1.origam-responsive
- Root element. Flex container, overflow hidden. Receives dimension, padding, margin, border and rounded classes.
- 2.origam-responsive__sizer
- Zero-height helper div. Its padding-block-end (set via useAspectRatio) forces the container to the correct ratio height.
- 3.origam-responsive__content
- Absolutely positioned content area filling the ratio-locked space. Receives contentClass.
API
Props
All props accepted by this component, with their type, default value and description.
- aspectRatiostring | number
- Desired aspect ratio expressed as 'width/height' string (e.g. '16/9') or a decimal number. When set, drives the padding-block-end sizer trick.
- contentClassstring
- Additional CSS class applied to the inner .origam-responsive__content div.
- inlinebooleanfalse
- Switches the root from display:block to display:inline-flex, making the container flow inline with text.
- heightnumber | string
- Explicit height override. Accepts a CSS length or a number (converted to px).
- maxHeightnumber | string
- Maximum height. Useful to cap a 16/9 container at a given viewport height.
- maxWidthnumber | string
- Maximum width.
- minHeightnumber | string
- Minimum height.
- minWidthnumber | string
- Minimum width.
- widthnumber | string
- Explicit width override.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring
- paddingboolean | number | string
- Shorthand CSS padding applied to the root container.
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- Shorthand CSS margin applied to the root container.
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border to the responsive container.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- Border-radius applied to the container (clips overflow of the content).
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
API
Slots
Content slots exposed by this component.
- #additional
- Extra content placed between the sizer and the main content div. Useful for overlays or decorative layers.
- #default
- Content placed inside .origam-responsive__content, absolutely positioned to fill the ratio-locked area.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to child components.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Default aspect ratio when no aspectRatio prop is set.
- Overflow applied to the root container. Hidden by default to clip content.
- Default max-width of the responsive container.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
Notes
- OrigamResponsive is a pure layout container with no interactive role. Accessibility is owned by the content placed in the default slot.
- When wrapping an iframe or img, ensure the embedded element has appropriate title or alt attributes for screen readers.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- other1.7778
- Default aspect ratio applied when no prop is set.
- other100%
- Default max-width of the container.
- otherhidden
- Overflow mode — hidden clips content to the ratio box.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
16/9 video embed
Responsive image
Inline mode