shadcn.io is not affiliated with official shadcn/ui
Alternating Code Block Rows Features Block for React
Three alternating bands for a typed event-stream client, each pairing a sentence with a code window that draws a different artifact: a call with its autocomplete popover, a config file with one line marked, and a command's output.
Installation
Overview
A features section for React with Base UI that sells a developer product with its own code. Three bands share one page column: a badge, a heading, a sentence and a text link on one side, and a code window in a hairline frame with + marks on its corners on the other. The sides swap row by row, and each window draws a different artifact: a typed call with an autocomplete popover under the caret, a config file with one marked line, and a command's output in a terminal. The code follows your theme in two weights of text, with no syntax colours and no forced dark window. The page's rails and top rule come from the Guides spine, and each band's rule is drawn by Guides too, so the marks land on it. For SDKs, APIs and developer tools where a few lines of code do more selling than a screenshot.
FAQ
How do I put in my own code?
Edit the line lists at the top of the file: CALL_LINES, CONFIG_LINES and OUTPUT_LINES. Each line is a string, and the text between two tildes is drawn in the strong weight while the rest stays quiet. Set marked on a line to tint it and rule its start, as in the config window. Keep a line under about 40 characters so it fits a phone without clipping.
Can I use a syntax highlighter instead?
Yes. The windows are plain markup inside the frame, so replace the body of a window with the output of your highlighter. This block draws code as a picture of the product, so it is hidden from assistive technology; if the snippet is the content you want people to copy, render it as real text in a labelled region instead.
Where do the links go?
Each row ends in a text link (href="#"): point it at the matching docs page. The arrow slides on hover and mirrors in a right-to-left layout. Nothing on the page is a button, so there is no primary control and no Shine Button.
Does the code window follow my theme?
Yes. The window, its tinted body and the marked line use theme tokens only, so they are light on a light page and dark on a dark one, in any preset. The selected suggestion in the popover is the one element drawn in the foreground colour.
Related
- Pro
Alternating Mockup Rows Features
Alternating rowsThree alternating bands for a support back office, each pairing a sentence with a browser window that holds a different admin screen: a filtered ticket table, a settings form with toggles and a weekly chart with its legend.
- Pro
Alternating Device Frame Rows Features
Alternating rowsTwo alternating rows for a transit app, each pairing a sentence with a phone drawn as a ring on a hairline floor: the trip planner with line chips and the live arrivals with countdowns.
- Pro
Alternating Rows Features
Alternating rowsTwo plain alternating rows for a design-system kit in one box of shared hairlines: a permissions card with three toggles, and a notification card over a stack of avatars.
- Pro
Alternating Stripe Sections Features
Alternating rowsThree tinted stripes for a CI platform: pipeline runs beside their copy, an environments table beside its copy, then a centred statement over a three-cell grid of build figures.
- Pro
Live Code Playground Showcase Features
App screensA code window in a framed figure with three language tabs, a copy button, and a Run button that shows a spinner and then a typed response panel, for a typed SDK.
- Pro
Split Code Preview Hero
Code and terminalA 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.