LogoLogo
  • What is UDML?
  • Document structure
    • <components>
    • <imports>
    • <instructions>
    • <meta>
    • <styles>
    • <tokens>
    • <mappings>
    • <screens>
  • Directives
    • ai-hint
    • <data> Directive Specification
    • <interaction> Directive
    • <layer> Directive
    • <repeat> Directive
    • <responsive>
    • selection
    • <tracking> Directive
  • Components
    • Layout
      • <accordion> Component
      • <box> Component
      • <column> Component
      • <divider>
      • <grid> Component
      • <row> Component
    • Navigation
      • <breadcrumbs> Component
      • <pagination> Component
      • <tab> Component
      • <tabs> Component
    • Text & Display
      • <avatar>
      • <heading>
      • <icon>
      • <image>
      • <label>
      • <text>
      • <video>
    • Controls & Input
      • <button>
      • <checkbox>
      • <input> Component
      • <radio>
      • <select>
      • <slider>
      • <stepper>
      • <switch>
      • <textarea>
    • Forms
      • <form> Component
      • <formField> Component
      • <formGroup> Component
    • Data Collections
      • <dataColumn> Component
      • <dataTable> Component
      • <list> Component
      • <timeline> Component
      • <treeView> Component
    • Data Visualization
      • <chart> Component
      • <summary> Component
    • Modals
      • <dialog> Component
      • <modal> Component
      • <popover> Component
      • <toast> Component
      • <tooltip> Component
  • Prompting Guides
    • Prompting AI Developer Tools with UDML
    • Working with UDML in an Existing Codebase
  • Contributing to UDML
Powered by GitBook
On this page
  • 🧠 Purpose
  • 🛠 Syntax
  • Recommended Approach (Explicit Structure)
  • 🔑 Breakpoint Reference Model
  • ✅ Attributes
  • <breakpoint>
  • ✅ Example
  • 🧩 AI Interpretation Guidelines
  • 🧠 Design Tool Behavior
  • 🗂 Related Features
  • 🔧 Future Support Ideas
Edit on GitHub
  1. Directives

<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)

<responsive>
  <breakpoint ref="desktop">
    <layout type="grid" columns="3">
      <image src="1.jpg"/>
      <image src="2.jpg"/>
      <image src="3.jpg"/>
    </layout>
  </breakpoint>
  <breakpoint ref="mobile">
    <carousel>
      <image src="1.jpg"/>
      <image src="2.jpg"/>
      <image src="3.jpg"/>
    </carousel>
  </breakpoint>
</responsive>

🔑 Breakpoint Reference Model

Breakpoints should be defined in the <tokens> section using:

<breakpoint name="mobile" max="767px"/>
<breakpoint name="tablet" min="768px" max="1023px"/>
<breakpoint name="desktop" min="1024px"/>

Then referenced using ref="..." in <breakpoint> blocks inside <responsive>.


✅ Attributes

<breakpoint>

Attribute
Required
Description

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

<responsive>
  <breakpoint ref="desktop">
    <layout type="row">
      <text>Item A</text>
      <text>Item B</text>
    </layout>
  </breakpoint>
  <breakpoint ref="mobile">
    <layout type="stack">
      <text>Item A</text>
      <text>Item B</text>
    </layout>
  </breakpoint>
</responsive>

🧩 AI Interpretation Guidelines

  • Use the <responsive> block to generate conditional layout logic or responsive classes/media queries

  • Respect 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 variants

  • Conditional 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


Previous<repeat> DirectiveNextselection

Last updated 2 months ago