Content
Compare Slider
Shows two versions of the same thing, either side by side behind a draggable divider or one at a time behind a switch.
Group: Content. Exports: CompareSlider, BeforeAfterToggle. Halaska addition with no shadcn/ui equivalent.
Usage
import { CompareSlider } from "./halaska-kit";
CompareSlider props
beforeReactNode:afterReactNode:initialnumber(default 0.5):labelsarray(default ["Before", "After"]):styleCSSProperties: Inline style merged onto the root element.
BeforeAfterToggle props
beforeReactNode:afterReactNode:
Accessibility
- The CompareSlider handle is a button with role slider and a value from 0 to 100.
- Left and Right arrows move the divider by 5 percent. Home and End jump to either edge.
- The idle drift is skipped when the user prefers reduced motion.
- BeforeAfterToggle uses a native button with role switch. Both versions stay in the DOM, so screen readers can read both.
Halaska UI · Components · Patterns · Screens · Install