MCPcopy Create free account
hub / github.com/MagicCube/agentara / CodeBlock

Function CodeBlock

web/src/components/ai-elements/code-block.tsx:421–443  ·  view source on GitHub ↗
({
  code,
  language,
  showLineNumbers = false,
  className,
  children,
  ...props
}: CodeBlockProps)

Source from the content-addressed store, hash-verified

419};
420
421export const CodeBlock = ({
422 code,
423 language,
424 showLineNumbers = false,
425 className,
426 children,
427 ...props
428}: CodeBlockProps) => {
429 const contextValue = useMemo(() => ({ code }), [code]);
430
431 return (
432 <CodeBlockContext.Provider value={contextValue}>
433 <CodeBlockContainer className={className} language={language} {...props}>
434 {children}
435 <CodeBlockContent
436 code={code}
437 language={language}
438 showLineNumbers={showLineNumbers}
439 />
440 </CodeBlockContainer>
441 </CodeBlockContext.Provider>
442 );
443};
444
445export type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
446 onCopy?: () => void;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected