<responsive>
The <responsive>
directive allows UDML authors to define layout and component behavior that changes based on viewport size. It supports adaptive UI structures for mobile, tablet, and desktop scenarios and works by conditionally rendering alternative layouts or components at defined breakpoints.
🧠Purpose
To make semantic designs responsive across screen sizes, while keeping them intuitive to define, render, and generate from AI tooling.
🛠Syntax
Recommended Approach (Explicit Structure)
🔑 Breakpoint Reference Model
Breakpoints should be defined in the <tokens>
section using:
Then referenced using ref="..."
in <breakpoint>
blocks inside <responsive>
.
✅ Attributes
<breakpoint>
<breakpoint>
ref
Yes
The name of the breakpoint token (e.g., mobile
, desktop
)
min
No*
Optional pixel value override if no token is used
max
No*
Optional pixel value override if no token is used
*Prefer using
ref
.min
/max
are fallbacks or overrides.
✅ Example
🧩 AI Interpretation Guidelines
Use the
<responsive>
block to generate conditional layout logic or responsive classes/media queriesRespect the order of
<breakpoint>
elements (more specific last)Match
ref
values to declared breakpoints in<tokens>
If no match, fallback to
min
/max
for manual media query generation
🧠Design Tool Behavior
Render only the appropriate layout per screen size
Allow preview switching between breakpoints
Show fallback/placeholder elements for unsupported sizes
🗂 Related Features
<tokens>
→breakpoint
declarations<layout>
and component variantsConditional logic directives (
<if>
,condition
, etc.)
🔧 Future Support Ideas
Responsive style overrides (e.g.
fillStyle="..."
per breakpoint)Responsive slot content or component visibility
Default vs override merging logic
Last updated