Text component (deprecated)

Contents

A text component holds rich text directly within a page region. This reference covers existing pages that still contain these components.

Text components are deprecated in XP 8. For new implementations, use a part with an HtmlArea field.

Existing content

Existing text components can still appear in page data and be queried through Guillotine. A front-end rendering such pages needs to handle type: "text" until those components have been replaced.

The replacement part defines its rich-text field in a schema and exposes it through the part’s configuration. See Parts for configuration queries and Rich text for processing and rendering the value.

Querying via GraphQL

Text components appear in the flat components list with type: "text". Their text.value field is a RichText object with raw, processedHtml and structured reference fields, just like an HtmlArea field.

{
  guillotine(project: "myproject", branch: "master") {
    get(key: "/site/articles/hello") {
      components {
        type
        path
        text {
          value {
            raw
            processedHtml
          }
        }
      }
    }
  }
}
One text entry from data.guillotine.get.components
{
  "type": "text",
  "path": "/main/0",
  "text": {
    "value": {
      "raw": "<p>Welcome</p>",
      "processedHtml": "<p>Welcome</p>"
    }
  }
}

The text field is null on other component types. For text containing links, images or macros, also select the structured reference fields and rewrite placeholders before rendering; see Rich text.


Contents

Contents