🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(web): design-system CodeSection replaces CodeView (#18462)
Trang Nguyen4a3b706a5cd3
diff --git a/web/src/components/design-system/CodeSection/CodeSection.stories.tsx b/web/src/components/design-system/CodeSection/CodeSection.stories.tsxnew file mode 100644index 0000000000..3aae10a310--- /dev/null+++ b/web/src/components/design-system/CodeSection/CodeSection.stories.tsx@@ -0,0 +1,148 @@+import React from "react";+import { ExternalLink, RefreshCw } from "lucide-react";+import { expect, userEvent, within } from "storybook/test";++import preview from "../../../../.storybook/preview";+import { CodeSection } from "./CodeSection";++type Variant = NonNullable<React.ComponentProps<typeof CodeSection>["variant"]>;++const variants = Object.keys({+ filled: true,+ outline: true,+ plain: true,+} satisfies Record<Variant, true>) as Variant[];++const envCode = `LANGFUSE_SECRET_KEY="sk-lf-..."+LANGFUSE_PUBLIC_KEY="pk-lf-..."+LANGFUSE_BASE_URL="https://cloud.langfuse.com"`;++const longCode = Array.from(+ { length: 14 },+ (_, index) =>+ `line ${index + 1}: const value${index + 1} = compute(${index + 1});`,+).join("\n");++const longLine =+ "Authorization: Basic cGstbGYtMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwOnNrLWxmLTAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMA==";++const meta = preview.meta({+ component: CodeSection,+});++export const Default = meta.story({+ args: {+ title: ".env",+ content: envCode,+ },+});++export const Outline = meta.story({+ args: {+ title: "HF Space Host",+ variant: "outline",+ content: "https://huggingface.co/spaces/org/langfuse",+ },+});++export const Plain = meta.story({+ args: {+ title: "Python",+ variant: "plain",+ content: 'prompt = langfuse.get_prompt("movie-critic")',+ },+});++export const WithoutTitle = meta.story({+ args: {+ variant: "outline",+ content: "sk-lf-00000000-0000-0000-0000-000000000000",+ },+});++export const WithActions = meta.story({+ args: {+ title: "Webhook Secret",+ variant: "outline",+ content: "whsec_0000000000000000000000000000",+ actions: [+ { icon: RefreshCw, label: "Regenerate", onClick: () => {} },+ { icon: ExternalLink, label: "Open docs", onClick: () => {} },+ ],+ },+});++export const CustomBody = meta.story({+ args: {+ title: "Text Prompt",+ content: "Answer {{question}} using {{context}}.",+ children: (+ <>+ Answer <span className="text-primary-accent">{"{{question}}"}</span>{" "}+ using <span className="text-primary-accent">{"{{context}}"}</span>.+ </>+ ),+ },+});++export const Collapsible = meta.story({+ args: {+ title: "Text Prompt",+ isCollapsible: true,+ defaultCollapsed: true,+ content: longCode,+ },+});++export const WithCopiedMessage = meta.story({+ args: {+ title: ".env",+ content: envCode,+ copiedMessage: "Secrets are not included, create a new key to copy them.",+ },+});++export const LongLineWithoutWrap = meta.story({+ args: {+ variant: "outline",+ shouldWrapLines: false,+ content: longLine,+ },+});++export const VariantMatrix = meta.story({+ render: () => (+ <div className="grid gap-6">+ {variants.map((variant) => (+ <div key={variant} className="grid gap-4">+ <CodeSection+ title={variant}+ variant={variant}+ content={envCode}+ isCollapsible+ />+ <CodeSection variant={variant} content={envCode} />+ </div>+ ))}+ </div>+ ),+});++export const TogglesCollapse = meta.story({+ name: "(Test) Toggles Collapse",+ args: {+ title: "Text Prompt",+ isCollapsible: true,+ defaultCollapsed: true,+ content: longCode,+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const toggle = canvas.getByRole("button", { name: "Expand" });+ await expect(toggle).toHaveAttribute("aria-expanded", "false");+ await userEvent.click(toggle);+ await expect(+ canvas.getByRole("button", { name: "Collapse" }),+ ).toHaveAttribute("aria-expanded", "true");+ },+});diff --git a/web/src/components/design-system/CodeSection/CodeSection.tsx b/web/src/components/design-system/CodeSection/CodeSection.tsxnew file mode 100644index 0000000000..b50d179acf--- /dev/null+++ b/web/src/components/design-system/CodeSection/CodeSection.tsx@@ -0,0 +1,202 @@+"use client";++import { cva } from "class-variance-authority";+import {+ Check,+ ChevronsDownUp,+ ChevronsUpDown,+ Copy as CopyIcon,+ type LucideIcon,+} from "lucide-react";+import { type ReactNode, useState } from "react";++import { IconButton } from "../IconButton/IconButton";+import { Tooltip } from "../Tooltip/Tooltip";+import { useCopyToClipboard } from "@/src/hooks/useCopyToClipboard";++const bodyVariants = cva("relative flex min-w-0 max-w-full items-start", {+ variants: {+ variant: {+ filled: "bg-surface-output rounded-md",+ outline: "bg-background rounded-md border",+ plain: null,+ },+ },+ defaultVariants: {+ variant: "filled",+ },+});++const codeVariants = cva(+ "ph-no-capture min-w-0 max-w-full flex-1 px-4 py-3 font-mono text-xs",+ {+ variants: {+ wrap: {+ true: "wrap-break-word whitespace-pre-wrap",+ false: "overflow-x-auto whitespace-pre",+ },+ collapsed: {+ true: "line-clamp-6",+ false: "block",+ },+ },+ defaultVariants: {+ wrap: true,+ collapsed: false,+ },+ },+);++const actionGroupVariants = cva(+ // Revealed on hover/focus only; touch devices have no hover, so the controls stay visible there.+ "flex min-w-0 shrink-0 items-center gap-1 group-hover/codesection:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100",+ {+ variants: {+ placement: {+ header: null,+ body: "pt-2 pr-2",+ },+ // Copy feedback stays visible even when the pointer has already left.+ isPinned: {+ true: "opacity-100",+ false: "opacity-0",+ },+ },+ },+);++type CodeSectionAction = {+ icon: LucideIcon;+ label: string;+ onClick: () => void;+};++type CodeSectionProps = {+ /** Text copied by the built-in copy button; also the body when there are no children. */+ content: string;+ /** Custom body, e.g. highlighted variables; copy still uses `content`. */+ children?: ReactNode;+ /** Omitted = no header row; actions move into the body's top-right corner. */+ title?: string;+ variant?: "filled" | "outline" | "plain";+ /** Extra icon actions rendered before expand/collapse and copy. */+ actions?: CodeSectionAction[];+ /** Shown next to the check icon after copying. */+ copiedMessage?: string;+ /** Clamps the body to six lines and adds an expand/collapse control. */+ isCollapsible?: boolean;+ defaultCollapsed?: boolean;+ shouldWrapLines?: boolean;+};++export function CodeSection({+ content,+ children,+ title,+ variant = "filled",+ actions = [],+ copiedMessage,+ isCollapsible = false,+ defaultCollapsed = false,+ shouldWrapLines = true,+}: CodeSectionProps) {+ const [isCollapsed, setIsCollapsed] = useState(+ isCollapsible && defaultCollapsed,+ );+ const { copy, isCopied } = useCopyToClipboard({+ successDuration: copiedMessage ? 3_000 : 1_000,+ });++ const handleCopy = async () => {+ try {+ await copy(content);+ } catch {+ // Clipboard writes can be rejected when the browser denies permission.+ }+ };++ const actionGroup = (+ <div+ className={actionGroupVariants({+ placement: title ? "header" : "body",+ isPinned: isCopied,+ })}+ >+ {isCopied && copiedMessage ? (+ <span+ className="text-muted-foreground min-w-0 truncate text-xs"+ title={copiedMessage}+ >+ {copiedMessage}+ </span>+ ) : null}+ {actions.map((action) => (+ <Tooltip key={action.label} label={action.label}>+ {({ getTriggerProps }) => (+ <IconButton+ {...getTriggerProps()}+ icon={action.icon}+ label={action.label}+ size="sm"+ variant="ghost"+ onClick={action.onClick}+ />+ )}+ </Tooltip>+ ))}+ {isCollapsible ? (+ <Tooltip label={isCollapsed ? "Expand" : "Collapse"}>+ {({ getTriggerProps }) => (+ <IconButton+ {...getTriggerProps()}+ icon={isCollapsed ? ChevronsUpDown : ChevronsDownUp}+ label={isCollapsed ? "Expand" : "Collapse"}+ size="sm"+ variant="ghost"+ aria-expanded={!isCollapsed}+ onClick={() => setIsCollapsed((value) => !value)}+ />+ )}+ </Tooltip>+ ) : null}+ <Tooltip label={isCopied ? "Copied" : "Copy"}>+ {({ getTriggerProps }) => (+ <IconButton+ {...getTriggerProps()}+ icon={isCopied ? Check : CopyIcon}+ label="Copy to clipboard"+ size="sm"+ variant="ghost"+ onClick={handleCopy}+ />+ )}+ </Tooltip>+ </div>+ );++ return (+ <div className="group/codesection flex max-w-full min-w-0 flex-col gap-1">+ {title ? (+ <div className="flex h-6 shrink-0 items-center justify-between gap-2">+ <div className="min-w-0 truncate text-sm font-bold" title={title}>+ {title}+ </div>+ {actionGroup}+ </div>+ ) : null}+ <div className={bodyVariants({ variant })}>+ <code+ className={codeVariants({+ wrap: shouldWrapLines,+ collapsed: isCollapsed,+ })}+ dir="auto"+ style={{ unicodeBidi: "plaintext" }}+ >+ {children ?? content}+ </code>+ {title ? null : actionGroup}+ </div>+ </div>+ );+}diff --git a/web/src/components/ui/CodeJsonViewer.tsx b/web/src/components/ui/CodeJsonViewer.tsxindex 047d3f6751..d3c7334cca 100644--- a/web/src/components/ui/CodeJsonViewer.tsx+++ b/web/src/components/ui/CodeJsonViewer.tsx@@ -2,14 +2,7 @@/* eslint-disable @repo/no-style-props */import { useMemo, useState } from "react";import { Button } from "@/src/components/ui/button";-import {- Check,- ChevronsDownUp,- ChevronsUpDown,- Copy,- FoldVertical,- UnfoldVertical,-} from "lucide-react";+import { FoldVertical, UnfoldVertical } from "lucide-react";import { cn } from "@/src/utils/tailwind";import { default as React18JsonView } from "react18-json-view";import "react18-json-view/src/dark.css";@@ -27,7 +20,6 @@ import {usePromptReferenceProjectId,} from "@/src/components/ui/PromptReferences";import { copyTextToClipboard } from "@/src/utils/clipboard";-import { useCopyToClipboard } from "@/src/hooks/useCopyToClipboard";export const IO_TABLE_CHAR_LIMIT = 10000;@@ -228,139 +220,6 @@ export function JSONView(props: {);}-export function CodeView(props: {- content: string | React.ReactNode[] | undefined | null;- originalContent?: string;- className?: string;- defaultCollapsed?: boolean;- title?: string;- scrollable?: boolean;- copiedToClipboardMessage?: string;- lineWrap?: boolean;-}) {- const { copiedToClipboardMessage } = props;- const lineWrap = props.lineWrap ?? true;-- const [isCollapsed, setCollapsed] = useState(props.defaultCollapsed);-- const { copy, isCopied } = useCopyToClipboard({- successDuration: copiedToClipboardMessage ? 3_000 : 1_000,- });-- const handleCopy = async (event: React.MouseEvent<HTMLButtonElement>) => {- event.preventDefault();- const button = event.currentTarget;- const content =- props.originalContent ??- (typeof props.content === "string"- ? props.content- : (props.content?.join("\n") ?? ""));-- try {- await copy(content);- } catch {- // Clipboard writes can be rejected when the browser denies permission.- }-- if (button) {- // Keep focus on the copy button to prevent focus shifting- // Note: the original button might no longer be in the DOM if React re-rendered the component after the state update.- button.focus();- }- };-- const handleShowAll = () => setCollapsed(!isCollapsed);-- const CopySuccessIcon = useMemo(() => {- return (- <div className="animate-appear relative h-3">- <Check className="icon-sm" />- {copiedToClipboardMessage && (- <div- className="text-secondary-foreground absolute top-0 right-0 mr-6 h-full max-w-[60vw] transform truncate overflow-hidden text-right text-sm leading-none whitespace-nowrap"- title={copiedToClipboardMessage}- >- {copiedToClipboardMessage}- </div>- )}- </div>- );- }, [copiedToClipboardMessage]);-- return (- <div- className={cn(- "flex max-w-full min-w-0 flex-col",- props.className,- props.scrollable && "max-h-full min-h-0",- )}- >- <>- {props.title ? (- <div className="my-1 flex shrink-0 items-center justify-between pl-1">- <div className="text-sm font-bold">{props.title}</div>- <Button- variant="ghost"- size="icon-xs"- onClick={handleCopy}- className=""- >- {isCopied ? (- CopySuccessIcon- ) : (- <Copy className="icon-sm text-icon-foreground" />- )}- </Button>- </div>- ) : undefined}- </>- <div- className={cn(- "relative flex max-w-full min-w-0 flex-col gap-2 overflow-hidden rounded-md border",- props.scrollable ? "max-h-full min-h-0 overflow-hidden" : "",- )}- >- {!props.title && (- <Button- variant="secondary"- size="icon-xs"- onClick={handleCopy}- className="absolute top-2 right-2 z-10"- >- {isCopied ? CopySuccessIcon : <Copy className="icon-sm" />}- </Button>- )}- <code- className={cn(- "ph-no-capture relative max-w-full min-w-0 flex-1 px-4 py-3 font-mono text-xs",- !props.title && !lineWrap ? "w-[calc(100%-2.5rem)] pr-12" : "",- lineWrap- ? "wrap-break-word whitespace-pre-wrap"- : "overflow-x-auto whitespace-pre",- isCollapsed ? `line-clamp-6` : "block",- props.scrollable ? "overflow-y-auto" : "",- )}- dir="auto"- style={{ unicodeBidi: "plaintext" }}- >- {props.content}- </code>- {props.defaultCollapsed ? (- <div className="flex gap-2 py-2 pr-2">- <Button variant="secondary" size="xs" onClick={handleShowAll}>- {isCollapsed ? (- <ChevronsUpDown className="icon-sm" />- ) : (- <ChevronsDownUp className="icon-sm" />- )}- </Button>- </div>- ) : undefined}- </div>- </div>- );-}-export const JsonSkeleton = ({numRows = 10,borderless = false,diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent.tsxindex e48e2c9176..53906839af 100644--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent.tsx+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent.tsx@@ -1,4 +1,4 @@-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import { DialogBody } from "@/src/components/ui/dialog";export function GeneratedKeyContent({@@ -13,7 +13,9 @@ export function GeneratedKeyContent({This key can only be viewed once. You can always create new keys inthe organization settings.</p>- <CodeView content={generatedKeys.secretKey} className="mt-2" />+ <div className="mt-2">+ <CodeSection variant="outline" content={generatedKeys.secretKey} />+ </div></div></DialogBody>);diff --git a/web/src/features/auth/HfSpacesPage.tsx b/web/src/features/auth/HfSpacesPage.tsxindex 3edfa79c4b..35233322e2 100644--- a/web/src/features/auth/HfSpacesPage.tsx+++ b/web/src/features/auth/HfSpacesPage.tsx@@ -8,7 +8,7 @@ import { LangfuseIcon } from "@/src/components/design-system/LangfuseIcon/Langfuimport Head from "next/head";import Link from "next/link";import { PlusIcon } from "lucide-react";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";export type PageProps = {deploymentDomain: string;@@ -40,7 +40,11 @@ export default function HfSpacesPage({ deploymentDomain }: PageProps) {<div className="bg-card mt-14 rounded-lg px-6 py-10 shadow-sm sm:mx-auto sm:w-full sm:max-w-[480px] sm:px-10"><div className="space-y-8">- <CodeView content={deploymentDomain} title="HF Space Host" />+ <CodeSection+ title="HF Space Host"+ variant="outline"+ content={deploymentDomain}+ /><Button className="w-full" asChild><Linkdiff --git a/web/src/features/automations/components/WebhookSecretRender.tsx b/web/src/features/automations/components/WebhookSecretRender.tsxindex 9310fbb77b..8148e0214b 100644--- a/web/src/features/automations/components/WebhookSecretRender.tsx+++ b/web/src/features/automations/components/WebhookSecretRender.tsx@@ -1,5 +1,5 @@import React from "react";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";export const WebhookSecretRender = ({webhookSecret,@@ -15,7 +15,7 @@ export const WebhookSecretRender = ({automation settings if needed. Use this secret to verify webhooksignatures in your endpoint.</div>- <CodeView content={webhookSecret} defaultCollapsed={false} />+ <CodeSection variant="outline" content={webhookSecret} /></div></>);diff --git a/web/src/features/automations/components/actions/WebhookActionForm.tsx b/web/src/features/automations/components/actions/WebhookActionForm.tsxindex b0b739db7b..22ba506278 100644--- a/web/src/features/automations/components/actions/WebhookActionForm.tsx+++ b/web/src/features/automations/components/actions/WebhookActionForm.tsx@@ -35,7 +35,7 @@ import {PopoverTrigger,} from "@/src/components/ui/popover";import { WebhookSecretRender } from "../WebhookSecretRender";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import { showSuccessToast } from "@/src/features/notifications";import { cn } from "@/src/utils/tailwind";@@ -277,12 +277,11 @@ export const WebhookActionForm: React.FC<WebhookActionFormProps> = ({<div className="rounded-md border p-3"><div className="flex items-center gap-2"><div className="flex-1">- <CodeView- className="bg-muted/50"+ <CodeSection+ variant="outline"content={(action.config as SafeWebhookActionConfig).displaySecretKey}- defaultCollapsed={false}/></div><div className="flex gap-2">diff --git a/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx b/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsxindex 57e5e58f08..b74f14e138 100644--- a/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx+++ b/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx@@ -30,7 +30,7 @@ import { Switch } from "@/src/components/design-system/Switch/Switch";import { api } from "@/src/utils/api";import { useHasProjectAccess } from "@/src/features/rbac";import { CodeMirrorEditor } from "@/src/components/editor/CodeMirrorEditor";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import { type Prisma, WebhookProtectedHeaders } from "@langfuse/shared";import { Skeleton } from "@/src/components/ui/skeleton";import { getFormattedPayload } from "@/src/features/experiments/utils/format";@@ -236,7 +236,7 @@ export const RemoteExperimentUpsertForm = ({</DialogDescription></DialogHeader><DialogBody>- <CodeView content={oneTimeSecret} defaultCollapsed={false} />+ <CodeSection variant="outline" content={oneTimeSecret} /></DialogBody><DialogFooter><Button@@ -358,10 +358,11 @@ export const RemoteExperimentUpsertForm = ({{field.value &&existingRemoteExperiment?.displaySecretKey && (<div className="pt-2">- <CodeView- className="bg-muted/50"+ <CodeSection+ variant="outline"+ isCollapsible+ defaultCollapsedcontent={existingRemoteExperiment.displaySecretKey}- defaultCollapsed={true}/><div className="text-muted-foreground mt-1 text-xs">Secret is encrypted and can only be viewed whendiff --git a/web/src/features/projects/components/HostNameProject.tsx b/web/src/features/projects/components/HostNameProject.tsxindex b88cb46003..a6fb567bb4 100644--- a/web/src/features/projects/components/HostNameProject.tsx+++ b/web/src/features/projects/components/HostNameProject.tsx@@ -1,11 +1,12 @@import { Card } from "@/src/components/ui/card";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import Header from "@/src/components/layouts/header";import { useUiCustomization } from "@/src/ee/features/ui-customization";import { env } from "@/src/env.mjs";export function HostNameProject() {const uiCustomization = useUiCustomization();+ const hostName = `${uiCustomization?.hostname ?? window.origin}${env.NEXT_PUBLIC_BASE_PATH ?? ""}`;return (<div><Header title="Host Name" />@@ -14,9 +15,7 @@ export function HostNameProject() {<div className="mb-2 text-sm">When connecting to Langfuse, use this hostname / baseurl.</div>- <CodeView- content={`${uiCustomization?.hostname ?? window.origin}${env.NEXT_PUBLIC_BASE_PATH ?? ""}`}- />+ <CodeSection variant="outline" content={hostName} /></div></Card></div>diff --git a/web/src/features/prompts/components/prompt-detail.tsx b/web/src/features/prompts/components/prompt-detail.tsxindex e2332b2aa3..b8062f20d9 100644--- a/web/src/features/prompts/components/prompt-detail.tsx+++ b/web/src/features/prompts/components/prompt-detail.tsx@@ -11,7 +11,8 @@ import type { z } from "zod";import { ChatMessageList } from "@/src/features/traces";import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { Badge } from "@/src/components/ui/badge";-import { CodeView, JSONView } from "@/src/components/ui/CodeJsonViewer";+import { JSONView } from "@/src/components/ui/CodeJsonViewer";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import { DetailPageNav } from "@/src/features/navigate-detail-pages";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import { api } from "@/src/utils/api";@@ -723,16 +724,14 @@ export const PromptDetail = ({) : typeof prompt.prompt === "string" ? (resolutionMode === "resolved" &&promptGraph.data?.resolvedPrompt ? (- <CodeView- content={String(promptGraph.data.resolvedPrompt)}+ <CodeSectiontitle="Text Prompt (resolved)"+ content={String(promptGraph.data.resolvedPrompt)}/>) : (- <CodeView- content={renderRichPromptContent(prompt.prompt)}- originalContent={prompt.prompt}- title="Text Prompt"- />+ <CodeSection title="Text Prompt" content={prompt.prompt}>+ {renderRichPromptContent(prompt.prompt)}+ </CodeSection>)) : (<JSONView json={prompt.prompt} title="Prompt" />@@ -754,8 +753,10 @@ export const PromptDetail = ({</Tabs.Content><Tabs.Content value="use-prompt" layout="fill"><div className="flex h-full min-h-0 w-full flex-col gap-2 overflow-y-auto pb-4">- {pythonCode && <CodeView content={pythonCode} title="Python" />}- {jsCode && <CodeView content={jsCode} title="JS/TS" />}+ {pythonCode && (+ <CodeSection title="Python" content={pythonCode} />+ )}+ {jsCode && <CodeSection title="JS/TS" content={jsCode} />}<p className="text-muted-foreground pl-1 text-xs">See{" "}<adiff --git a/web/src/features/public-api/components/ApiKeyDetailContent.tsx b/web/src/features/public-api/components/ApiKeyDetailContent.tsxindex 4fcd5150f9..2d91e3ca4e 100644--- a/web/src/features/public-api/components/ApiKeyDetailContent.tsx+++ b/web/src/features/public-api/components/ApiKeyDetailContent.tsx@@ -1,6 +1,6 @@/* eslint-disable @repo/no-style-props */+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import { SubHeader } from "@/src/components/layouts/header";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";import { Label } from "@/src/components/ui/label";import { getLangfuseEnvCode } from "@/src/features/public-api/hooks/useLangfuseEnvCode";import { cn } from "@/src/utils/tailwind";@@ -40,15 +40,21 @@ export function ApiKeyDetailContent(props: ApiKeyDetailContentProps) {This key can only be viewed once. You can always create new keys inthe {scope} settings.</div>- <CodeView content={secretKey} className="mt-2" />+ <div className="mt-2">+ <CodeSection variant="outline" content={secretKey} />+ </div></div><div><SubHeader title="Public Key" />- <CodeView content={publicKey} className="mt-2" />+ <div className="mt-2">+ <CodeSection variant="outline" content={publicKey} />+ </div></div><div><SubHeader title=".env" />- <CodeView content={envCode} className="mt-2" />+ <div className="mt-2">+ <CodeSection variant="outline" content={envCode} />+ </div></div>{showMcpSection ? (<>@@ -70,11 +76,13 @@ export function ApiKeyDetailContent(props: ApiKeyDetailContentProps) {</p><div className="mt-4"><Label>Header</Label>- <CodeView- content={`Authorization: Basic ${mcpCredential}`}- className="mt-2"- lineWrap={false}- />+ <div className="mt-2">+ <CodeSection+ variant="outline"+ shouldWrapLines={false}+ content={`Authorization: Basic ${mcpCredential}`}+ />+ </div></div></div></>diff --git a/web/src/features/public-api/components/ApiKeyList.tsx b/web/src/features/public-api/components/ApiKeyList.tsxindex b154a9c5f4..a432e6c676 100644--- a/web/src/features/public-api/components/ApiKeyList.tsx+++ b/web/src/features/public-api/components/ApiKeyList.tsx@@ -1,8 +1,8 @@import startCase from "lodash/startCase";import { Alert } from "@/src/components/design-system/Alert/Alert";+import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";import Header from "@/src/components/layouts/header";-import { CodeView } from "@/src/components/ui/CodeJsonViewer";import { CreateApiKeyButton } from "@/src/features/public-api/components/CreateApiKeyButton";import { ConnectedApiKeySettingsTable } from "@/src/features/public-api/components/ApiKeySettingsTable/ConnectedApiKeySettingsTable";import { useLangfuseEnvCode } from "@/src/features/public-api/hooks/useLangfuseEnvCode";@@ -72,10 +72,11 @@ export function ApiKeyList(props: { entityId: string; scope: ApiKeyScope }) {) : undefined}/>- <CodeView- content={envCode}+ <CodeSectiontitle=".env"- copiedToClipboardMessage="Secrets are not included, create a new key to copy them."+ variant="outline"+ copiedMessage="Secrets are not included, create a new key to copy them."+ content={envCode}/><ConnectedApiKeySettingsTableentityId={entityId}