shadcn.io is not affiliated with official shadcn/ui
Split Panel Crosshair Visual CTA Block for React
A split call to action beside a reticle field that fills its half of the block edge to edge: crosshair lines follow the pointer or the arrow keys, with a live coordinate readout.
Installation
Overview
A split call to action with an interactive visual, for React with Base UI, here for Fieldstone, a fictional component kit. On one side sit a headline, a paragraph, a Shine Button, an outline button and a short note. On the other, behind a split divider, a field with a faint grid and three concentric rings fills its whole half, edge to edge, from the top rule to the foot of the block and out to the end rail. It holds a reticle: two fine lines and a small ring that follow your pointer, with a Kbd readout of its coordinates, such as x 128, y 64. Leave the field and the reticle glides back to the centre rings. It's built from Shine Button, Button, Grid Pattern, Kbd and Guides with Tailwind CSS. Made for design system, developer tool and documentation pages that want a quiet, precise visual instead of a screenshot.
FAQ
How does the reticle follow the pointer?
The field turns the pointer's position into coordinates in a 256 by 128 space (x from its start edge, y up from its bottom edge, as on a graph), and the lines read them from two CSS variables, --x and --y, set on the field. Nothing is drawn on a canvas and no animation library runs: the lines are two one-pixel elements placed with start-(--x) and top-(--y). While the pointer or keyboard focus is in the field the lines track it directly; once both leave, a short CSS transition glides them back to the centre.
Can I move the reticle without a mouse?
Yes. Inside the field are two real range inputs, named "Reticle, horizontal position" and "Reticle, vertical position", hidden visually but in the tab order. Tab to one and the arrow keys move the reticle 8 units at a time (Page Up and Page Down take bigger steps, Home and End jump to the edges), and a ring shows inside the field while one has focus. A screen reader reads each one as a slider with its value from 0 to 256 or 0 to 128.
How do I change the coordinate space, the rings or the readout?
WIDTH and HEIGHT at the top of the file set the space the readout counts in, and STEP sets the arrow-key distance. The field fills whatever box its half gives it and the coordinates are shares of that box, so nothing needs to match its shape. RINGS lists the rings as a share of the field's height. The readout is a Kbd fixed at 14 characters wide, so it doesn't change size as the digits do. Drop it, or print the position another way, if your page doesn't need it.
What happens in right-to-left layouts?
The field is always left to right, like a map or a code pane: the reticle follows the pointer's real position, and the readout keeps "x" before "y". The copy beside it, the divider and the buttons flip as usual.
Does it work on a touch screen?
Yes. Dragging a finger across the field moves the reticle, and lifting it sends the reticle home. Vertical swipes still scroll the page, because the field only takes sideways drags (touch-pan-y), so it never traps a phone's scroll.
How does it fit a phone?
The copy comes first, so the Shine Button is on the first screen, and the field follows under a rule that runs from rail to rail. It is a fixed height there (18rem, then 24rem from sm) and still edge to edge.
What moves, and what about reduced motion?
The copy fades and rises in once, the rings dim while the reticle is in use, the reticle glides back to the centre, and the Shine Button sweeps a band of light across itself on hover or focus. With reduced motion on, the entrance and the glide are off, so the reticle jumps, and the light fades in instead. It still follows the pointer and the arrow keys, since that is your own input, not animation.
Related
- Pro
Split Panel Product Mockup CTA
Product previewsA split call to action for a browser extension: the pitch and a Shine Button at the start, its popup with working bookmarks in a hairline frame at the end, and a closing band of three ruled benefits.
- Pro
Split Panel Video Player Preview CTA
Product previewsA split call to action for a deploy platform: the pitch and a Shine Button at the start, a wide demo player in a hairline frame at the end: a poster drawn from the product over three chapter tabs.
- Pro
Split Panel Calendar Grid CTA
Pickers and togglesA split call to action beside a week-by-time availability grid on a framed card: pick a free slot and the Shine Button names it.
- Pro
Dot Grid Backdrop CTA
Drawn accentsA centred call to action between solid rails over a halftone dot field that clears behind the copy, with a version badge, the Shine Button, a ghost link and a closing band of three facts in your theme.
- Pro
Centered CTA Dotted Background Hero
BackdropsA showcase centered hero on a dot grid framed by hairlines: the dots light up near the pointer, with a release pill, a display headline, a Shine Button and an outline button.
- Pro
Inset Notification Toast Preview CTA
Product previewsA card-in-card call to action for a team inbox with a working notification tray: the pitch and a Shine Button beside a tray where a button fires toasts, newest on top, each with Undo and close.