Content primitive that reserves a fixed media ratio around slotted content.
Install @wyrd-company/react or the Flutter package and use it directly —
your DESIGN.md does the styling.
catalog/contracts/aspect-ratio.ymlsource of truth · verbatim
$schema: https://thewyrdingway.dev/schemas/component-contract.schema.ymlcontractVersion: 0.1.0identity:name: AspectRatiotag: wyrd-aspect-ratiopackage: wyrd.component.aspect-ratiotitle: Aspect Ratiosummary: Content primitive that reserves a fixed media ratio around slotted content.relationships:related-to: - quality-parity-and-gatesclassification:category: structurecomposition: single-slotinteractive: falsetarget-strategy:react: requiredflutter: requiredsurface:properties: - name: ratiotype:kind: enumvalues: - 1-1 - 4-3 - 3-2 - 16-9 - 21-9required: falsedefault: 16-9reflects: trueserializable: truesummary: Fixed ratio enum; maps normatively to 1/1, 4/3, 3/2, 16/9, or 21/9.slots: - name: contentcontent: truerequired: truecardinality: one-or-manyaccepts: - content - componentsummary: Content constrained by the selected aspect ratio.events: []states: - name: defaultsource: platformsummary: Content is constrained to the selected ratio.parts: - name: rootsummary: Aspect-ratio box.slots: - contentmessages: []obligations:accessibility:role: nonekeyboard: []semantics: - Adds no accessibility semantics of its own. - Preserves the semantics and document order of slotted content.behavior:model: statelessinteractions: []hostEffects: []conditions: - rtl - density-compact - text-expansionsdui:status: serializableserializableProperties: - ratioserializableSlots: - contenteventBindings: []notes: Aspect Ratio serializes a deliberate fixed ratio enum; arbitrary numeric ratios can be added later without changing current values.examples: - name: video-thumbnailstate: defaultproperties:ratio: 16-9slots:content: Product walkthrough | Generate a component for every required target - name: square-artworkstate: defaultproperties:ratio: 1-1slots:content: Release 0.12 | Catalog artwork - name: panoramic-bannerstate: defaultproperties:ratio: 21-9slots:content: The Wyrding Way | Author the component once. Let the platforms agree.overrides:react:slots:content: childrenflutter:slots:content: child
01
Examples
Generated from the contract's examples block.
Previews are the published @wyrd-company/react component, themed by the
brand's role tokens — flip the site's light/dark toggle and they follow.
video-thumbnailstate: default
Usage
import portraitUrl from"../example-assets/workbench-portrait.png";
import { WyrdAspectRatio } from"@wyrd-company/react";
export function MediaExample() {
return (
<WyrdAspectRatio ratio="16-9">
<img src={portraitUrl} alt="Illustrated designer working at a dark workbench" />
</WyrdAspectRatio>
);
}
import'package:flutter/widgets.dart';
import'package:wyrd_flutter/wyrd_flutter.dart';
Widget mediaExample() => WyrdAspectRatio(
ratio: WyrdAspectRatioRatio.value16_9,
child: const [
Image(
image: AssetImage(
'assets/examples/workbench-portrait.png',
package: 'wyrd_flutter',
),
semanticLabel: 'Illustrated designer working at a dark workbench',
),
],
);
The Wyrding WayAuthor the component once. Let the platforms agree.
Usage
import { WyrdAspectRatio } from"@wyrd-company/react";
<WyrdAspectRatio ratio="21-9">
The Wyrding Way | Author the component once. Let the platforms agree.
</WyrdAspectRatio>
import'package:wyrd_flutter/wyrd_flutter.dart';
WyrdAspectRatio(
ratio: '21-9',
child: Text('The Wyrding Way | Author the component once. Let the platforms agree.'),
)
02
Properties
Name
Type
Default
Summary
ratio
1-1 | 4-3 | 3-2 | 16-9 | 21-9
16-9
Fixed ratio enum; maps normatively to 1/1, 4/3, 3/2, 16/9, or 21/9.
03
Slots & events
Slot
Cardinality
Accepts
Summary
content
one-or-many
content, component
Content constrained by the selected aspect ratio.
04
States
State
Source
Summary
default
platform
Content is constrained to the selected ratio.
05
Accessibility
From the contract's accessibility obligations. Role none
Adds no accessibility semantics of its own.
Preserves the semantics and document order of slotted content.
Status: serializable. Aspect Ratio serializes a deliberate fixed ratio enum; arbitrary numeric ratios can be added later without changing current values.