shadcn.io is not affiliated with official shadcn/ui
Before After Visual Features Block for Vue
Three measured outcomes as ruled rows, each with its own Before and After control that swaps both the figure and the bar: page weight, load time and weekly support tickets.
Installation
Overview
A features section for Vue with Ark UI that proves a change with numbers. Three rows share one page column, divided by hairlines, each measuring one outcome: page weight, load time and weekly support tickets. A row has its own Before and After control. Choosing After rolls the figure's digits to the new value, eases the bar to its new width and writes how much less it is, all worked out from the two numbers; a hairline on the bar shows where it will land. The control is the segmented group, so each row works from the keyboard and reads as a pair of radio buttons. For performance, cost and efficiency products where the result is the pitch.
FAQ
How do I put in my own measurements?
Edit METRICS at the top of the file. Each entry has a before and an after value, the number of decimals to show, a unit and a one-line note. The bar's width, the hairline marking the result and the "less than before" figure are all worked out from those two values, so you only type each number once.
Does one control change every row?
No. Each row keeps its own state, so a visitor can compare one outcome at a time. To drive all three from one control, lift the view state into the section and pass it down to the rows.
How is it announced to a screen reader?
The control is a labelled group of two options named for its row ("Page weight: before or after"). When the choice changes, a polite live region reads the row's title, the choice and the new figure, such as "Page weight, after: 1.2 MB". The bar itself is decorative.
Does it follow my theme?
Yes. The bar, its track and the control use theme tokens only, and the bar is drawn in the foreground colour, so the primary colour stays free for a real button. The page has no button of its own and no Shine Button.
Related
- Before After Toggle FeaturesLive controls
- Traditional Vs Modern Split FeaturesProof and comparisons
- Drag Handle Responsive Comparator FeaturesLive controls
- Split Layout Before After Slider HeroInteractive demos
- Full-Width Before After Slider HeroInteractive demos
- Metric Hero Strip FeaturesMetrics and charts