Skip to content
shadcn.io

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.

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

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.

What moves, and what happens with reduced motion?

The header fades up once on load with a CSS transition, and the link arrows slide on hover. Nothing loops. With reduced motion every transition is off and the section just appears.

How does it fit on a phone?

Each band stacks with the text first. The window drops to a fixed height and fades out at its foot, so a long file reads as continuing rather than cut off. The window clips its lines instead of scrolling, and nothing scrolls sideways at 320 pixels.

  • Pro

    Three 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

    Two 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

    Two 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

    Three 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

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