The text content or input object. If string, the input can be normal text or an equation. If object, it can be a text, equation, or mention object.
Optionaloptions: {Options for configuring the rich text object
Optionalannotations?: {Options for the Annotation object
Optionalbold?: booleanBold text
Optionalitalic?: booleanItalic text
Optionalstrikethrough?: booleanStrikethrough text
Optionalunderline?: booleanUnderlined text
Optionalcode?: booleanCode-style text
Optionalcolor?: stringString specifying the text's color or background color. Options: "blue", "brown", "default", "gray", "green", "orange", "pink", "purple", "red", "yellow". All except "default" can also be used as a background color with "[color]_background" - example: "blue_background". See: https://developers.notion.com/reference/rich-text#the-annotation-object
Optionalurl?: stringThe URL for this object, if any. Creates a clickable link.
Optionaltype?: stringAn optional type for the Rich Text Object. Supports text, equation, and mention.
// Simple text
buildRichTextObj("Hello World")
// Text with URL
buildRichTextObj("Watch this very important video", { url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" })
// Text with annotations
buildRichTextObj("Bold and brown", {
annotations: { bold: true, color: "brown" }
})
// Text with URL and annotations
buildRichTextObj("Bold blue link", {
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
annotations: { bold: true, color: "blue" }
})
// Equation
buildRichTextObj("E = mc^2", { type: "equation" })
// Mention
buildRichTextObj({ type: "user", user: { id: "user_id" } }, { type: "mention" })
buildRichTextObj({ type: "date", date: { start: "2025-01-01" } }, { type: "mention" })
buildRichTextObj({ type: "database", database_id: "database_id" }, { type: "mention" })
buildRichTextObj({ type: "page", page_id: "page_id" }, { type: "mention" })
Builds a Rich Text Object. See: https://developers.notion.com/reference/rich-text