shadcn.io is not affiliated with official shadcn/ui
Sticky Title Card Case Study Blog Block for React
A customer story told as a post: a sticky title card with a typographic cover at the start and, across a split divider, Challenge, Solution and Results bands whose three before-and-after pairs are thin bars with counting figures.
Installation
Overview
A case-study block for React with Base UI, written for Plainfield Stories, a customer-stories site, about a nine-shop bakery. At the start, a title card that sticks as the story scrolls: the headline, a one-line dek, a "Case study 07" cover set in display type, two facts about the customer and the author's byline. At the end of a split divider, three bands: Challenge and Solution in a few sentences each, and Results, which holds three before-and-after pairs. Each pair is two thin bars on one scale (the larger figure fills the track) with the "after" figure counting up once as it scrolls into view and the change worked out from the two numbers, so the headline's percentage and the figures never disagree. It's built from Avatar, Counting Number and Guides. For customer stories, project write-ups and any post that ends on measured results. The bakery and its figures are invented example data.
FAQ
How do I change the customer and the figures?
Edit RESULTS at the top of the file: each pair has a label, a before and an after figure and the unit after them. The bar lengths, the "−61%" lines and the percentage in the headline (taken from the first pair, WASTE) are all worked out from those numbers. The customer's facts are FACTS, the story text sits in the three bands, and the author is AUTHOR.
How are the bars scaled?
Within a pair, the larger of the two figures fills the whole track and the other is its share of it, so a pair always shows the real proportion between its own two numbers. Pairs use their own scale, because their units differ; the percentage beside each is what compares them. The bars are decoration: the figures and the change are text.
Does the counting number respect reduced motion?
Yes. The "after" figures count up once, when the Results band scrolls into view, and show their final value at once with reduced motion. A screen reader reads the final figure, never the count.
What does sticky mean here?
From lg the title card sticks near the top of the screen while the bands beside it scroll past, as long as the page is taller than the card. On a phone the card comes first and the bands follow; nothing sticks.
Related
- Pro
Q and A Interview Blog
Story formatsAn interview told in four question-and-answer bands: the host's question at the start, the guest's answer at the end, both speakers' initials avatars in the header, and one phrase marked with a highlighter.
- Pro
Select Pair Comparison Blog
Story formatsTwo Selects pick two of five posts and the posts stand in two columns on a split divider, with Length, Level, Topics, Updated and Takeaway rows that line up and a line saying how many rows differ.
- Pro
Margin Note Editorial Blog
Featured storyThree editor's picks as split rows: the post with a numeral tile at the start and, in a tinted margin cell at the end, the editor's note with a hanging quote mark and a marked reason.
- Pro
Author Frame Guest Post Blog
Article partsA guest post on an outdoors blog: a header with the one Pitch a guest post button, an article under a Guest post badge, and an About the author frame with a bio and three icon links that carry tooltips.
- Pro
Case Study Testimonial
Results and figuresA customer case study for a freight-tracking app, split by a hairline divider: the headline, a Shine Button and an at-a-glance list beside Challenge, Solution and Result bands with a headline figure and a pull quote.
- Pro
Before and After Load Time Stats
ComparisonsA page-speed comparison with the time before a tune, the time after it, and the seconds saved on a connecting line between two dots.