Basic Example

{
  "type": "text",
  "text": "Sample textblock content",
  "replacements": {
    "course": "Introduction to Programming",
    "instructor": "Dr. Smith"
  },
  "as": "span",
  "margin": "none",
  "textAlign": "start"
}

Live Example

Example Code
[
  {
    "type": "text",
    "text": "Welcome to {courseName}, {userName}!",
    "replacements": {
      "courseName": "Advanced JavaScript",
      "userName": "Dr. Smith"
    },
    "as": "p",
    "margin": "small"
  }
]

Properties

type
string
required
Identifies this as a text blockMust be text
text
string
required
The text content to display, may include replacement tokens like
replacements
object
required
Optional key-value pairs for text replacements
as
string
default:"span"
required
The HTML element type to render as (e.g., ‘span’, ‘div’, ‘p’)
margin
string
default:"none"
required
Margin spacing around the text blockAllowed values: none, auto, xxx-small, xx-small, x-small, small, medium, large, x-large, xx-large
textAlign
string
default:"start"
required
Text alignment within the blockAllowed values: start, center, end

Usage Notes

  • This element is part of the BlockKit system for building dynamic user interfaces
  • All properties marked as (required) must be included in your JSON structure
  • Optional properties can be omitted and will use their default values when applicable