Skip to content

prop

const prop: object

Defined in: src/helpers/property.helpers.ts:350

Factory functions for constructing page property values.

checkbox: (checked) => object

Create a checkbox property value.

boolean

object

checkbox: boolean

prop.checkbox(true)

date: (start, options?) => DateValue

Create a date property value.

string | null

ISO 8601 date or datetime string.

DateOptions

Optional end date and time zone.

DateValue

prop.date('2025-01-15')
prop.date('2025-01-15', { end: '2025-01-20' })
prop.date('2025-01-15T09:00:00', { timeZone: 'America/New_York' })
prop.date(null) // clear the date

email: (value) => object

Create an email property value.

string | null

object

email: string | null

prop.email('user@example.com')
prop.email(null) // clear

files: (entries) => object

Create a files property value.

FileEntry[]

object

files: ExternalFileEntry[]

prop.files([{ name: 'doc.pdf', url: 'https://example.com/doc.pdf' }])

multiSelect: (names) => object

Create a multi-select property value.

string[]

object

multi_select: object[]

prop.multiSelect(['Tag1', 'Tag2'])

number: (value) => object

Create a number property value.

number | null

object

number: number | null

prop.number(42)
prop.number(null) // clear the value

people: (userIds) => object

Create a people property value from an array of user IDs.

string[]

object

people: object[]

prop.people(['user-id-1', 'user-id-2'])

phoneNumber: (value) => object

Create a phone number property value.

string | null

object

phone_number: string | null

prop.phoneNumber('+1-555-0100')
prop.phoneNumber(null) // clear

relation: (pageIds) => object

Create a relation property value from an array of page IDs.

string[]

object

relation: object[]

prop.relation(['page-id-1', 'page-id-2'])

richText: (text) => object = richTextProp

Create a rich text property value.

RichTextInput

object

rich_text: ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: … | …; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: … | … | …; id: string; name?: … | …; object: "user"; person: { email: …; email_verified?: …; }; type: "person"; } | { avatar_url?: … | … | …; bot: { owner: …; workspace_id?: …; workspace_limits?: …; workspace_name?: …; }; id: string; name?: … | …; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]

prop.richText('Some notes')
prop.richText(richText('Formatted').italic())

select: (name) => object

Create a select property value.

string | null

object

select: { name: string; } | null

prop.select('Option A')
prop.select(null) // clear the selection

status: (name) => object

Create a status property value.

string | null

object

status: { name: string; } | null

prop.status('In Progress')
prop.status(null) // clear the status

title: (text) => object

Create a title property value.

RichTextInput

object

title: ({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: … | …; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: … | … | …; id: string; name?: … | …; object: "user"; person: { email: …; email_verified?: …; }; type: "person"; } | { avatar_url?: … | … | …; bot: { owner: …; workspace_id?: …; workspace_limits?: …; workspace_name?: …; }; id: string; name?: … | …; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]

prop.title('My Page')
prop.title(richText('Bold Title').bold())

url: (value) => object

Create a URL property value.

string | null

object

url: string | null

prop.url('https://example.com')
prop.url(null) // clear the URL

verification: (state, date?) => VerificationValue

Create a verification property value.

"verified" | "unverified"

VerificationDateOptions

VerificationValue

prop.verification('verified')
prop.verification('verified', { start: '2025-01-15' })
prop.verification('unverified')
import { prop, richText } from '@visus-io/notion-sdk-ts';
notion.pages.create({
parent: { database_id: 'db-id' },
properties: {
Name: prop.title('My Task'),
Status: prop.status('In Progress'),
Priority: prop.select('High'),
'Due Date': prop.date('2025-02-01'),
Score: prop.number(95),
Done: prop.checkbox(false),
Tags: prop.multiSelect(['urgent', 'frontend']),
Assignee: prop.people(['user-id']),
Notes: prop.richText(richText('Important').bold()),
},
});