diff --git a/docs/components/api-method.tsx b/docs/components/api-method.tsx index bb918cd8..bc498b6e 100644 --- a/docs/components/api-method.tsx +++ b/docs/components/api-method.tsx @@ -144,6 +144,7 @@ export const APIMethod = ({ noResult ? "" : `const ${resultVariable} = ` }await auth.api.${functionName}(${serverBody});${code_suffix}`} lang="ts" + allowCopy={!isClientOnly} /> ); @@ -243,6 +244,7 @@ export const APIMethod = ({ }, error } = ` }await authClient.${authClientMethodPath}(${clientBody});${code_suffix}`} lang="ts" + allowCopy={!isServerOnly} /> {isServerOnly ? (
diff --git a/docs/components/ui/dynamic-code-block.tsx b/docs/components/ui/dynamic-code-block.tsx index 4fc82ef2..c814e568 100644 --- a/docs/components/ui/dynamic-code-block.tsx +++ b/docs/components/ui/dynamic-code-block.tsx @@ -34,6 +34,12 @@ export interface DynamicCodeblockProps { * @defaultValue true */ wrapInSuspense?: boolean; + /** + * Allow to copy code with copy button + * + * @defaultValue true + */ + allowCopy?: boolean; options?: Omit & HighlightOptionsThemes; } @@ -63,6 +69,7 @@ export function DynamicCodeBlock({ codeblock, options, wrapInSuspense = true, + allowCopy = true, }: DynamicCodeblockProps) { const shikiOptions = { lang, @@ -85,7 +92,9 @@ export function DynamicCodeBlock({ ); - return {children}; + return ( + {children} + ); } function Placeholder({