Responsive
Aspect-ratio container that constrains its content to a fixed ratio using a sizer trick. Supports dimension overrides and standard spacing props.
Aperçu
Rendu de l’aperçu en cours…
16/9Rendu de l’aperçu en cours…
4/3Rendu de l’aperçu en cours…
1/1Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
Emplacements de contenu exposés par ce composant.
- #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
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <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.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
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.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- 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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
16/9 video embed
Responsive image
Inline mode