shadcn.io is not affiliated with official shadcn/ui
Left Right Install Snippet CTA Block for React
A split call to action between solid rails that shows the install as a diff: a headline, a sentence and two actions at the start, and at the end a tinted half with a package.json window where a placeholder dependency is struck out and the real one added.
Installation
Overview
A developer call to action that makes the install the picture, for React with Base UI, for a component library called Kestrel. Between the page rails, a solid divider that meets the top rule splits the block in two. The start half holds "Move to Kestrel in one line", a one-line pitch, the Shine Button "Get started" and an outline "Read the docs". The end half is tinted and holds a small package.json window: a placeholder dependency is struck out and tinted red, then the real one appears tinted green, once, as the window scrolls into view. It's built from Diff Text, Guides, Shine Button and Button with CSS transitions and your theme's tokens, so the block is light on a light page and dark on a dark one. For libraries, SDKs and developer tools that close a page with the one change a visitor has to make.
FAQ
How do I show my own package?
Edit DIFF and FILE at the top of the file. The diff is written like a unified diff, one line per line: start a line with + to add it, - to remove it, or a space to leave it as context. The +1 and −1 counts in the window's header are worked out from those signs, so they always match.
How does the diff animate?
It's our Diff Text. Once the window is a quarter in view, the removed line tints and is struck through, then the added line slides in, all in CSS, and it plays once. The finished diff stays on screen. With reduced motion on, it is simply there from the start, and the headline and the buttons appear in place instead of fading up.
How does a screen reader read the diff?
The window is a figure named "Change to package.json". The removed line is a del element and the added line an ins element, each read with "Removed" or "Added" before it, and the header's counts read "+1 line added" and "−1 line removed". The code area is in the tab order with a visible focus ring so a keyboard can scroll a wide line.
Where do the links go?
Both are links (href="#"): point Get started at your quick start and Read the docs at your documentation.
Each button renders the link it's given with render, with nativeButton={false}.
How does the layout change with the screen?
From the lg breakpoint the text and the window sit side by side, split by a solid divider that runs up to the top rule. Below it they stack, the window after the text with a hairline between. Lines in the window never wrap: a wide one scrolls inside the window, never the page.
Related
- Pro
Inset Code Snippet Copy CTA
Code and commandsA card-in-card call to action for a data SDK, split by a hairline: the headline, one sentence and a Shine Button at the start, and a three-line quickstart snippet with a copy button on every line and a Copy all button at the end.
- Pro
Split Panel Terminal Cursor CTA
Code and commandsA split call to action for a web app starter: the pitch and a Shine Button at the start, a dark terminal pane filling the end column that waits at a prompt until you press Enter.
- Pro
Left Right CTA with Eyebrow Pill
Card in cardA card-in-card call to action that follows your theme: a headline with a quiet outline pill that links to a customer story, one sentence, and the Shine Button with an outline action at the end.
- Pro
Copy Link Share CTA
Forms and captureA band call to action for a referral programme that follows your theme: the pitch beside a read-only invite field with a Shine Button that copies it, real email and system share links, and a closing band counting invites.
- --++Pro
Split Layout Code Diff Hero
Code and terminalA 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.
- Pro
Install Command Hero
Code and terminalA 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.