mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
27 lines
690 B
TypeScript
27 lines
690 B
TypeScript
import {forwardRef} from "react";
|
|
import {clsx} from "@nextui-org/shared-utils";
|
|
|
|
export interface PreProps {
|
|
className?: string;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export const Pre = forwardRef<HTMLPreElement, PreProps>(
|
|
({className = "", children, ...props}, forwardedRef) => {
|
|
return (
|
|
<pre
|
|
ref={forwardedRef}
|
|
className={clsx(
|
|
"relative w-full h-full box-border shadow-md text-white/80 leading-5 whitespace-pre text-sm font-mono bg-code-background rounded-xl overflow-scroll [&>code]:transition-transform",
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</pre>
|
|
);
|
|
},
|
|
);
|
|
|
|
Pre.displayName = "CodeBlock.Pre";
|