Sidebar Presets

A collection of preset components in Notion sidebar.

Installation

npm install pnpm add @notion-kit/ui

Components


Workspace Switcher

A WorkspaceSwitcher is a dropdown menu that controls workspaces and user's login state.

API Reference

PropTypeDefaultDescription
user*User-Current user.
activeWorkspace*Workspace-Current user.
workspaces*Workspace[]-Current user.
onSelect(id: string) => void-Handler that is called when a workspace is selected.
onCreateAccount() => void-Handler that is called when the "Create Account" button is clicked.
onCreateWorkspace() => void-Handler that is called when the "Create or Join Workspace" button is clicked.
onLogout() => void-Handler that is called when the "Logout" button is clicked.

Page List

A page list is a component DocList showing a group of pages.

API Reference

PropTypeDefaultDescription
group*string-The identifier of the group.
title*string-The group title.
pages*Page[]-Pages in this group.
activePagestring | null-The active page in this group.
defaultIconIconData{ type: "lucide", src: "file" }The default icon of the page within this group. This is useful when a page has no icon selected.
isLoadingboolean-The loading state of this group. It will show a skeleton if the group is loading.
onSelect(id: string) => void-Handler that is called when a page is active.
onCreate(group: string, parentId?: string) => void-Handler that is called when the "Create" button is triggered in this group.
onDuplicate(id: string) => void-Handler that is called when the "Duplicate" action is triggered.
onUpdate(id: string, data: UpdatePageParams) => void-Handler that is called when the page data or page state is updated.

Favorite List

A FavoriteList is a group of pages that are marked as your Favorite.

Note

  • The FavoriteList only shows your Favorite pages that are not archived.

API Reference

PropTypeDefaultDescription
pages*Page[]-Pages in this group.
activePagestring | null-The active page in this group.
isLoadingboolean-The loading state of this group. It will show a skeleton if the group is loading.
onSelect(id: string) => void-Handler that is called when a page is active.
onCreate(group: string, parentId?: string) => void-Handler that is called when the "Create" button is triggered in this group.
onDuplicate(id: string) => void-Handler that is called when the "Duplicate" action is triggered.
onUpdate(id: string, data: UpdatePageParams) => void-Handler that is called when the page data or page state is updated.

Search Command

A SearchCommand is a command dialog for searching all non-archived pages.

Note

  • It searches only for non-archived pages.

API Reference

PropTypeDefaultDescription
workspaceName*string-The name of current workspace.
pages*Page[]-All your pages. But it searches only for non-archived pages.
onSelect(page: Page) => void-Handler that is called when a page is selected.
onOpenTrash() => void-Handler that is called when the "Open in Trash" button is clicked.

Trash Box

A TrashBox is a popover menu for searching archived pages.

Note

  • It searches only for archived pages.

API Reference

PropTypeDefaultDescription
pages*Page[]-All your pages. But it searches only for archived pages.
isOpenboolean-The (controlled) open state of the trash box. Must be used in conjunction with onOpenChange.
onOpenChange(open: boolean) => void-Handler that is called when the open state of the trash box changes.
onSelect(page: Page) => void-Handler that is called when a page is selected.
onRestore(id: string) => void-Handler that is called when the "Restore" button of the page is clicked.
onDelete(page: Page) => void-Handler that is called when the "Delete" button of the page is clicked.