icon
consticon:object
Defined in: src/helpers/file.helpers.ts:113
Helpers that create icon objects: emoji, external URL, file upload, native icon, or custom emoji.
Type Declaration
Section titled “Type Declaration”customEmoji
Section titled “customEmoji”customEmoji: (
id) =>CustomEmojiIconRef=customEmojiIcon
Create a custom emoji icon object, referencing a workspace custom emoji by id.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”CustomEmojiIconRef
Example
Section titled “Example”icon.customEmoji('emoji-id')emoji: (
emoji) =>EmojiIcon=emojiIcon
Create an emoji icon object.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”EmojiIcon
Example
Section titled “Example”icon.emoji('🚀')external
Section titled “external”external: (
url) =>ExternalRef=externalIcon
Create an external file icon object.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”ExternalRef
Example
Section titled “Example”icon.external('https://example.com/icon.png')fileUpload
Section titled “fileUpload”fileUpload: (
id) =>FileUploadRef=fileUploadIcon
Create a file-upload icon object.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”FileUploadRef
Example
Section titled “Example”icon.fileUpload('upload-id')native
Section titled “native”native: (
name,color?) =>NativeIconRef=nativeIcon
Create a native (icon-picker) icon object.
Parameters
Section titled “Parameters”string
color?
Section titled “color?”"blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow" | "lightgray"
Returns
Section titled “Returns”NativeIconRef
Example
Section titled “Example”icon.native('star circle', 'blue')Example
Section titled “Example”import { icon } from '@visus-io/notion-sdk-ts';
notion.pages.create({ parent: { page_id: 'page-id' }, icon: icon.emoji('📝'), // ...});