From 0aa34cc9a8282fb3dbbd53262d06d9216a774fc5 Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: Thu, 29 Jan 2026 17:32:56 +0100 Subject: [PATCH] Fix Embed options in React (#3964) --- .changeset/vast-emus-cheer.md | 6 ++++++ packages/embed/src/react/GitBookFrame.tsx | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .changeset/vast-emus-cheer.md diff --git a/.changeset/vast-emus-cheer.md b/.changeset/vast-emus-cheer.md new file mode 100644 index 000000000..ec13d0e52 --- /dev/null +++ b/.changeset/vast-emus-cheer.md @@ -0,0 +1,6 @@ +--- +"gitbook": patch +"@gitbook/embed": patch +--- + +Fix Embed options in React diff --git a/packages/embed/src/react/GitBookFrame.tsx b/packages/embed/src/react/GitBookFrame.tsx index b9f527fea..2a7f5b38b 100644 --- a/packages/embed/src/react/GitBookFrame.tsx +++ b/packages/embed/src/react/GitBookFrame.tsx @@ -11,13 +11,21 @@ import { useGitBook } from './GitBookProvider'; export type GitBookFrameProps = { className?: string; } & GetFrameURLOptions & - GitBookEmbeddableConfiguration; + Partial; /** * Render a frame with the GitBook Assistant in it. */ export function GitBookFrame(props: GitBookFrameProps) { - const { className, visitor, actions, greeting, suggestions, tools } = props; + const { + className, + visitor, + actions = [], + greeting, + suggestions = [], + tools = [], + tabs = ['assistant', 'docs'], + } = props; const frameRef = useRef(null); const gitbook = useGitBook(); @@ -33,13 +41,13 @@ export function GitBookFrame(props: GitBookFrameProps) { useEffect(() => { gitbookFrame?.configure({ - tabs: ['assistant', 'docs'], + tabs, actions, greeting, suggestions, tools, }); - }, [gitbookFrame, actions, greeting, suggestions, tools]); + }, [gitbookFrame, actions, greeting, suggestions, tools, tabs]); return (