prop
constprop:object
Defined in: src/helpers/property.helpers.ts:350
Factory functions for constructing page property values.
Type Declaration
Section titled “Type Declaration”checkbox
Section titled “checkbox”checkbox: (
checked) =>object
Create a checkbox property value.
Parameters
Section titled “Parameters”checked
Section titled “checked”boolean
Returns
Section titled “Returns”object
checkbox
Section titled “checkbox”checkbox:
boolean
Example
Section titled “Example”prop.checkbox(true)date: (
start,options?) =>DateValue
Create a date property value.
Parameters
Section titled “Parameters”string | null
ISO 8601 date or datetime string.
options?
Section titled “options?”DateOptions
Optional end date and time zone.
Returns
Section titled “Returns”DateValue
Example
Section titled “Example”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 dateemail: (
value) =>object
Create an email property value.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”object
email:
string|null
Example
Section titled “Example”prop.email('user@example.com')prop.email(null) // clearfiles: (
entries) =>object
Create a files property value.
Parameters
Section titled “Parameters”entries
Section titled “entries”FileEntry[]
Returns
Section titled “Returns”object
files:
ExternalFileEntry[]
Example
Section titled “Example”prop.files([{ name: 'doc.pdf', url: 'https://example.com/doc.pdf' }])multiSelect
Section titled “multiSelect”multiSelect: (
names) =>object
Create a multi-select property value.
Parameters
Section titled “Parameters”string[]
Returns
Section titled “Returns”object
multi_select
Section titled “multi_select”multi_select:
object[]
Example
Section titled “Example”prop.multiSelect(['Tag1', 'Tag2'])number
Section titled “number”number: (
value) =>object
Create a number property value.
Parameters
Section titled “Parameters”number | null
Returns
Section titled “Returns”object
number
Section titled “number”number:
number|null
Example
Section titled “Example”prop.number(42)prop.number(null) // clear the valuepeople
Section titled “people”people: (
userIds) =>object
Create a people property value from an array of user IDs.
Parameters
Section titled “Parameters”userIds
Section titled “userIds”string[]
Returns
Section titled “Returns”object
people
Section titled “people”people:
object[]
Example
Section titled “Example”prop.people(['user-id-1', 'user-id-2'])phoneNumber
Section titled “phoneNumber”phoneNumber: (
value) =>object
Create a phone number property value.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”object
phone_number
Section titled “phone_number”phone_number:
string|null
Example
Section titled “Example”prop.phoneNumber('+1-555-0100')prop.phoneNumber(null) // clearrelation
Section titled “relation”relation: (
pageIds) =>object
Create a relation property value from an array of page IDs.
Parameters
Section titled “Parameters”pageIds
Section titled “pageIds”string[]
Returns
Section titled “Returns”object
relation
Section titled “relation”relation:
object[]
Example
Section titled “Example”prop.relation(['page-id-1', 'page-id-2'])richText
Section titled “richText”richText: (
text) =>object=richTextProp
Create a rich text property value.
Parameters
Section titled “Parameters”RichTextInput
Returns
Section titled “Returns”object
rich_text
Section titled “rich_text”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_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"; })[]
Example
Section titled “Example”prop.richText('Some notes')prop.richText(richText('Formatted').italic())select
Section titled “select”select: (
name) =>object
Create a select property value.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”object
select
Section titled “select”select: {
name:string; } |null
Example
Section titled “Example”prop.select('Option A')prop.select(null) // clear the selectionstatus
Section titled “status”status: (
name) =>object
Create a status property value.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”object
status
Section titled “status”status: {
name:string; } |null
Example
Section titled “Example”prop.status('In Progress')prop.status(null) // clear the statustitle: (
text) =>object
Create a title property value.
Parameters
Section titled “Parameters”RichTextInput
Returns
Section titled “Returns”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_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"; })[]
Example
Section titled “Example”prop.title('My Page')prop.title(richText('Bold Title').bold())url: (
value) =>object
Create a URL property value.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”object
url:
string|null
Example
Section titled “Example”prop.url('https://example.com')prop.url(null) // clear the URLverification
Section titled “verification”verification: (
state,date?) =>VerificationValue
Create a verification property value.
Parameters
Section titled “Parameters”"verified" | "unverified"
VerificationDateOptions
Returns
Section titled “Returns”VerificationValue
Example
Section titled “Example”prop.verification('verified')prop.verification('verified', { start: '2025-01-15' })prop.verification('unverified')Example
Section titled “Example”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()), },});