EnterUI
DocsComponentsThemesExamplesDonation
Get Started
      • SkipLink
      • ToolbarButton
      • ToolbarGroup
      • CopyButton
      • CodeBlock
      • Kbd
      • VisuallyHidden

Default usage

  1. EnterUI
  2. /Docs
  3. /Layout and Utilities
  4. /Utilities
  5. /Accessibility and Actions
  6. /CodeBlock
Updated 3 October 2026

CodeBlock

A polished code block with title, terminal mode, and copy action.

CodeBlock defines how EnterUI handles a polished code block with title, terminal mode, and copy action, including default structure, accessible states, and token-driven styling.

#Default usage

Code block

Use title or data-title to label the snippet.

app/layout.tsx
import "@froggdesign/theme/styles.css";
import "@froggdesign/enter-ui-react/styles.css";

export default function RootLayout({ children }) {
return <body>{children}</body>;
}
Code
  <CodeBlock title="app/layout.tsx" language="tsx">
    <code>{`import "@froggdesign/theme/styles.css";
import "@froggdesign/enter-ui-react/styles.css";

export default function RootLayout({ children }) {
  return <body>{children}</body>;
}`}</code>
  </CodeBlock>

#Import

Code
import { CodeBlock } from "@froggdesign/enter-ui-react";

#Patterns

Terminal command

Terminal languages get a prompt affordance.

Install
pnpm install @froggdesign/enter-ui-react @froggdesign/theme

#Accessibility

CodeBlock keeps the code inside a native pre element and exposes a real copy button. The copy button has visible text and uses focus-visible styling.

#API

  • title or data-title controls the header label.
  • language can be passed directly or inferred from a child code class name.
  • showCopyButton, copyLabel, copiedLabel, and resetDelay customize copy behavior.
  • containerClassName styles the outer figure; className styles the inner pre.

#Styling

CodeBlock uses .eui-code-block classes and EnterUI CSS variables. It is intentionally darker than surrounding docs surfaces so code remains easy to scan.

PreviousCopyButton
NextKbd
On this page
  • Default usage
  • Import
  • Patterns
  • Accessibility
  • API
  • Styling