All coursesDesign systems for teams & AI agents
Build a flexible variable system

Build a flexible variable system

Connect primitives and semantics, adapt values with modes, and scale smoothly with functions.

Build a flexible variable system

Connect primitives and semantics, adapt values with modes, and scale smoothly with functions.

Your styles can keep using the same variables even when different sections or screen sizes need different values. Naming, aliases, modes, and functions help you set that up.

Name values and their purposes

Variable names can describe a value itself or the job it does. These approaches are called primitive and semantic naming, and they can work together.

Primitive variables

A primitive names a value in your palette or scale. For example, space-3xl holds a spacing size without assigning it to a specific use.

Semantic variables

A semantic variable names a purpose, such as section-padding. It can get its value from a primitive like space-3xl. That reference is called an alias.

Quick demo (no sound) → Connect section-padding to space-3xl so it gets its value from another variable.

Both hero-padding and section-padding can reference space-3xl. To change only the hero’s spacing, connect hero-padding to a different spacing variable. To change both together, update space-3xl.

Adapt spacing with responsive modes

A variable mode supplies different values for a specific context, such as a light or dark theme or a screen size.

For example, section-padding and hero-padding can use the same spacing in Base mode, then use different values in Mobile portrait to give the hero less padding. Each class keeps using its variable while the mode changes the value it receives.

section-padding and hero-padding reference space-2xl in Mobile landscape. In Mobile portrait, section-padding keeps space-2xl while hero-padding references space-l.

Tip. Mode values can use aliases too. Instead of entering a value like 2rem directly, you could connect section-padding to a smaller spacing variable from the same collection.

Automatic or manual?

An automatic mode applies when a condition is met, like the screen reaching a certain breakpoint. Your sections then use the spacing values set in that mode.

With a manual mode, you choose where it applies in the Style panel. For example, you could give one section a dark theme at any screen size.

Scale heading sizes with functions

Functions let a variable calculate its value instead of holding a fixed number or color. For example, you could:

  • Set section padding to twice your standard spacing value. When that spacing value changes, the padding updates too.
  • Mix your brand color with white for a pale card background. When the brand color changes, the background’s tint updates too.
  • Let a heading grow smoothly as the screen gets wider, within a minimum and maximum size.

For a heading that scales with screen width, clamp() sets three values:

  • Minimum: The smallest permitted size.
  • Preferred: A calculation that responds to viewport width.
  • Maximum: The largest permitted size.

A heading-display-size variable could use clamp(2.5rem, 7vw, 6.25rem). The middle value responds to viewport width, allowing the heading to scale between 2.5rem and 6.25rem.

Quick demo (sound on) → Replace a heading’s fixed variable values with clamp() and preview how its size scales with the screen width.

Your styles can keep using the same variables while modes and functions change the values they receive.

Keep going

Continue to the next lesson to see how elements and styles come together in reusable components.

1

Getting started

Coming soon

1

Background & preview
3:00
Background & preview
Coming soon

1

Intro to design systems in Webflow
8:40
Intro to design systems in Webflow
Coming soon

1

How the parts work together
3:30
How the parts work together
Coming soon

2

Styles & variables

Coming soon

2

Intro to variables
5:48
Intro to variables
Coming soon

2

Styles, variables, & naming
3:00
Styles, variables, & naming
Coming soon

2

Variables as a system
8:33
Variables as a system
Coming soon

2

Build a flexible variable system
2:30
Build a flexible variable system
Coming soon

3

Components

Coming soon

3

Intro to components
5:03
Intro to components
Coming soon

3

Build flexible components
3:00
Build flexible components
Coming soon

3

Properties, variants, & slots
4:28
Properties, variants, & slots
Coming soon

3

Components for teams & AI agents
3:00
Components for teams & AI agents
Coming soon

4

Pages & CMS content

Coming soon

4

Page templates
3:00
Page templates
Coming soon

4

Create a static page template
3:08
Create a static page template
Coming soon

4

Add components to CMS rich text
2:25
Add components to CMS rich text
Coming soon

4

Components in CMS rich text
2:30
Components in CMS rich text
Coming soon

5

Share & maintain your system

Coming soon

5

Shared Libraries
8:59
Shared Libraries
Coming soon

5

Bring in an existing site
4:00
Bring in an existing site
Coming soon

5

Use your system with AI
3:00
Use your system with AI
Coming soon

5

Best practices & resources
2:00
Best practices & resources
Coming soon

Course progress

0%

Assessment

Up next

Intro to components

Create, reuse, and update components to keep structure and styling consistent across your site.
Continue to next lesson
→
Complete course
✓