A slider component that allows comparison between two elements with a draggable divider.
✅ Early Returns
const getUserStatus = (user: User) => { if (!user.isActive) return 'inactive' if (!user.hasVerifiedEmail) return 'unverified' if (!user.hasPremium) return 'active' return 'premium' }
❌ Nested Conditionals
const getUserStatus = (user: User) => { if (user.isActive) { if (user.hasVerifiedEmail) { if (user.hasPremium) { return 'premium' } else { return 'active' } } else { return 'unverified' } } else { return 'inactive' } }
npx shadcn@latest add "https://ui.paukraft.com/r/comparison-slider"
The component to show on the left side
The component to show on the right side
Whether the slider line should disappear when not interacting
The default position of the slider in % from 0 to 100