For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
        • Get variable mode name
        • Set variable mode name
        • Get variable mode breakpoint
        • Set variable mode breakpoint
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • mode.getBreakpoint()
Variables & CollectionsVariable ModesManaging Variable Modes

Get variable mode breakpoint

Was this page helpful?
Previous

Set variable mode breakpoint

Next
Built with

mode.getBreakpoint()

Get the breakpoint that drives a variable mode. Automatic modes return their BreakpointId. Manual modes return null.

Syntax

1mode.getBreakpoint(): Promise<BreakpointId | null>

Returns

Promise<BreakpointId | null>: "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny"

A Promise that resolves to the BreakpointId for an automatic mode, or null for a manual mode.

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Get Variable Mode
5const variableMode = await collection?.getVariableModeByName(modeName)
6
7try {
8 // Get the breakpoint that drives the mode
9 const breakpointId = await variableMode?.getBreakpoint()
10
11 if (breakpointId != null) {
12 console.log(`Automatic mode driven by the "${breakpointId}" breakpoint`)
13 } else {
14 console.log("Manual mode")
15 }
16} catch (err) {
17 if (err.cause?.tag === "VariableModeInvalid") {
18 // The mode no longer exists or has been removed
19 console.warn(err.message)
20 } else {
21 throw err
22 }
23}

Try this example

A getBreakpoint call rejects with a VariableModeInvalid error when the mode no longer exists or has been removed (Variable mode with id "X" not found).

Catch this error to recover gracefully and surface the message to the user.

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny