From e33e515b8c2f7828eafc9f3545ac3e2659c67939 Mon Sep 17 00:00:00 2001 From: Yelena Chamanova Date: Fri, 24 Oct 2025 21:30:38 -0700 Subject: [PATCH] custom collection --- .../src/third-party/collection-view.tsx | 14 ++++++++++++++ packages/react-notion-x/src/types.ts | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/packages/react-notion-x/src/third-party/collection-view.tsx b/packages/react-notion-x/src/third-party/collection-view.tsx index 378550dc..761246b8 100644 --- a/packages/react-notion-x/src/third-party/collection-view.tsx +++ b/packages/react-notion-x/src/third-party/collection-view.tsx @@ -1,5 +1,6 @@ import React from 'react' +import { useNotionContext } from '../context' import { type CollectionViewProps } from '../types' import { CollectionViewBoard } from './collection-view-board' import { CollectionViewGallery } from './collection-view-gallery' @@ -8,18 +9,31 @@ import { CollectionViewTable } from './collection-view-table' export function CollectionViewImpl(props: CollectionViewProps) { const { collectionView } = props + const { components } = useNotionContext() switch (collectionView.type) { case 'table': + if (components.CollectionViewTable) { + return + } return case 'gallery': + if (components.CollectionViewGallery) { + return + } return case 'list': + if (components.CollectionViewList) { + return + } return case 'board': + if (components.CollectionViewBoard) { + return + } return default: diff --git a/packages/react-notion-x/src/types.ts b/packages/react-notion-x/src/types.ts index 4da775e1..1cc6132f 100644 --- a/packages/react-notion-x/src/types.ts +++ b/packages/react-notion-x/src/types.ts @@ -34,6 +34,12 @@ export interface NotionComponents { Collection: any Property?: any + // collection view components + CollectionViewGallery?: any + CollectionViewTable?: any + CollectionViewList?: any + CollectionViewBoard?: any + propertyTextValue: ComponentOverrideFn propertySelectValue: ComponentOverrideFn propertyRelationValue: ComponentOverrideFn