Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Split Layout Dark Terminal Hero Block for React

A split hero for an API: the headline, a Shine Button and three ticks beside a dark terminal with a request, a status and a JSON response that writes itself out, above a band of three figures.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A split hero for Packlane, a shipping-rates API. On the start side come an announcement link, the headline, a Shine Button with an outline second action and three short ticks. A divider separates them from a tinted panel holding the terminal: a title bar, the request's method and path, the response's status and timing with a working copy button, and the JSON body, which writes itself out key by key as it scrolls into view. A closing band of three figures, ruled with + marks, ends the hero. The block follows your theme; only the terminal window is dark, like a real terminal. For API products, developer platforms and backend services that want to show a real response rather than describe one.

FAQ

How do I show my own request and response?

Edit the constants at the top of the file: METHOD and ENDPOINT for the request line, and RESPONSE_TEXT for the body, written as the JSON you want to show. The terminal and the copy button both read from it, so what visitors copy is exactly what they see. Keep the body to ten lines or so, and prefer strings, as the block does: they read well on the dark window in every theme.

Does the terminal follow the theme?

The hero does: its section, copy, buttons and band are light in a light theme and dark in a dark one. Only the terminal carries the dark class, because a terminal reads as a dark window, so your theme's dark colours apply inside it. A border keeps it apart from a dark page. Remove the dark class and the terminal follows the page like the rest.

What does the copy button do?

It's our CopyButton: a press puts the response body on the clipboard, the icon turns into a check for a few seconds, and screen readers hear "Copied". If the browser refuses (no permission, or a page not served over HTTPS), it shows a cross and says so instead.

How does the JSON animate?

It's our JsonText, set to a quick pace. Once the terminal is a quarter in view, each key types itself out and its value fades in a beat later, then the next key. It plays once, in CSS. With reduced motion on, the JSON is simply there.

How does a screen reader read the terminal?

The terminal is a figure named "Terminal: an example quote", and everything in it is real text: the method, the path, "Response 201 Created 38 ms", the copy button (named "Copy the response") and the JSON. Only the title bar's three dots are hidden. The headline is the block's one h1, and the figures in the band are a description list.

How does it fit on a phone?

The columns stack below the lg breakpoint with the text first, so the Shine Button stays on the first screen, then a rule with + marks and the terminal on its tinted panel. A path too long for the request line ends with an ellipsis, and the copy button wraps under the status line if it runs out of room. The band keeps its three figures side by side with smaller type. Nothing scrolls sideways down to 320 px.

  • Pro

    Split API Playground Hero

    Code and terminal

    A showcase hero for a payments API: a headline, a Shine Button, a second action and three ticks, then a wide playground under its own rule: a POST request beside the 200 response, each JSON body writing itself out.

  • Pro

    Split Code Preview Hero

    Code and terminal

    A reverse split hero for a job-queue SDK: a code window in a hairline frame with a copy button, beside the headline, three checks and two calls to action.

  • Pro

    A split hero for a project scaffolder: text with a Shine Button and three stats on a ruled row, and a terminal in a hairline frame that shows the install command with a copy button and what it set up.

  • Pro

    A compact reverse split hero for an SDK: a dark code window with a deploy call and its JSON response beside the headline, a copyable install command and a Shine Button, over a closing band of three ruled feature cells.

  • Pro

    A showcase hero for a GraphQL gateway: the headline and the pitch with a Shine Button above a wide editor window in a hairline frame, with a schema explorer, a query that types itself in and its response.

  • Pro

    A showcase hero for a code review tool: a centred headline, a Shine Button, a second action and three ticks over a wide pull request window in a hairline frame, with a diff whose changes play out line by line.