Use Webflow Context
useWebflowContext()
Call the useWebflowContext
hook to get information about the current Webflow environment.
Webflow provides multiple modes to support different parts of the design process including designing, page building, previewing, and publishing. The useWebflowContext
hook provides information about the current mode and locale to help you adapt your component’s behavior and content accordingly.
Use useWebflowContext
when you need to:
- Adapt component behavior depending on the mode, provide placeholders, expanded states, or guidance for designers.
- Control interactivity - When in a non-interactive state, provide
- Handle localization with locale-specific content and formatting
Syntax
Returns
WebflowContext
- An object containing the current mode, interactive state, and locale.
WebflowContext properties
Examples
Conditional rendering based on interactive state
In this example, the accordion component opens by default in design mode (when not interactive) so designers can see the full content while working.
Locale-aware content
In this example, the component automatically switches to Spanish and French based on the locale.