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
      • Element Presets
      • DOM Elements
      • Strings
        • Get Text
        • Set Text
      • Components
      • Slots
      • Headings
      • Images
      • Links
      • Forms
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • element.setText(text)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsStrings

Set Text

Was this page helpful?
Previous

Component Instances

Next
Built with

element.setText(text)

Sets the text value on a String element, overwriting any prior text value.

Syntax

1element.setText(text: string): Promise<null>

Parameters

  • text: string - The new text for your StringElement

Returns

Promise<null>

A Promise that resolves to null.

Example

1// Get all elements and find the first StringElement
2const allElements = await webflow.getAllElements();
3const foundElement = allElements.find(el => el.type === "String");
4
5if (foundElement) {
6 // Check that element has the method in order to use it
7 if ('setText' in foundElement) {
8 const elementText = foundElement.setText("Hello Element 🚀"); // Set Text
9 }
10} else {
11 console.log('Element not found on page');
12}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canEditAnyAnyCanvasAny