Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Terminal Copy Command Hero Block for React

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.

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 a product you install with one command, for React with Base UI. On the left, between the page rail and a solid divider, sit a release pill, a headline, a supporting line, a Shine Button and an outline button, a note on the package managers it works with, and three stats in tabular figures on a row ruled with a hairline and + marks. On the right, in a frame of hairlines with + marks on its corners, a terminal window types the install command after a $ prompt, with a copy button in its title bar that puts the command on the clipboard and shows a check, and lists what the command set up. It's built from Announcement, Status, Copy Button, Shine Button, Button and Guides, with CSS transitions for the entrance and your theme's tokens for every colour, so the block, terminal included, is light on a light theme and dark on a dark one. For CLI tools, npm packages, developer frameworks and starter kits.

FAQ

How do I change the install command?

Edit COMMAND at the top of the file. It's what the terminal shows after the prompt and exactly what the copy button puts on the clipboard: the $ is drawn beside it, so it's never copied with it. Use any one-line command, such as npm create, curl … | sh or brew install. The terminal is laid out left to right even on a right-to-left page, the way a terminal reads, and a command too long for a narrow screen ends in an ellipsis rather than pushing the layout wide. Edit STEPS to change what the terminal lists under it.

What happens when someone presses Copy?

CopyButton writes the command with the Clipboard API, then swaps its copy icon for a check for three seconds, and a screen reader hears Copied. If the browser refuses (no permission, or a page that isn't served over HTTPS), the icon becomes a cross and the screen reader hears Couldn't copy, so nobody pastes an empty clipboard thinking it worked. To log copies, pass onCopiedChange: it's called with true when the check shows.

Is the terminal always dark?

No, it follows your theme. The window is bg-card with a hairline border and a soft shadow, and the output is plain text colours, so in a light theme the terminal is light and in a dark theme it is dark. If you want a terminal that is dark on a light page too, put the dark class on the window only, never on the section, and say so in a comment.

Is the terminal hero accessible for screen readers and keyboard users?

Yes. The command is real, selectable text in a code element, and the prompt before it is hidden from screen readers. The copy button is named Copy install command, so it says what it copies, and it announces the result in a polite status inside it. The listed output is a picture of the result, so it's hidden from assistive tech. The headline is the page's one h1, and the stats are a description list, so each figure is read with its label.

How does it fit on a phone?

The two columns stack below the lg breakpoint, the text first and the terminal under it between two hairlines, so the Shine Button is inside the first screen. The headline steps down from text-5xl to text-4xl and balances its lines. Below the sm breakpoint the terminal drops to 12px and the copy button shows its icon only, keeping its full name for screen readers. The three stats keep equal columns with their dividers.

How do I change the stats?

Edit STATS: each has a value, written as you want it shown (50K+, 12M, 24), and a label. They're laid out as three equal columns with a divider between each, which flips sides in a right-to-left layout. Keep three, or change grid-cols-3 to match; short values keep the columns readable on a phone.

  • Pro

    Install Command Hero

    Code and terminal

    A compact centred hero for an open-source library with a star count pill, an install command to copy, a Shine Button, a GitHub star button and a ruled band of the repository's stats at the foot.

  • Pro

    A compact centred hero for a web framework: an install command with a copy button, two calls to action and a band of three stats.

  • 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

    Code Window Hero

    Code and terminal

    A split hero for an API client generator on solid rails: a headline and a Shine Button beside a code window whose snippet comes in token by token, in a hairline frame with + marks.

  • 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 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.