Files
copilotkit__copilotkit/docs/components/react/image-and-code.tsx
2026-02-13 11:01:44 +01:00

28 lines
603 B
TypeScript

import { Tabs, Tab } from "@/components/react/tabs";
import { Frame } from "@/components/react/frame";
export function ImageAndCode({
preview,
children,
id,
}: {
preview: string | React.ReactNode;
children: React.ReactNode;
id: string;
}) {
return (
<Tabs groupId={id} items={["Preview", "Code"]}>
<Tab value="Preview">
{typeof preview === "string" ? (
<Frame>
<img className="rounded-lg w-full" src={preview} />
</Frame>
) : (
preview
)}
</Tab>
<Tab value="Code">{children}</Tab>
</Tabs>
);
}