🎉Paper UI v2.0 is here!
See what's new

PU-Compare Component

An interactive comparison slider component for visualizing differences between two states

Usage

Basic Usage

After
Before
Light/Dark Comparison
Light/Dark Comparison
Light/Dark Comparison
Light/Dark Comparison
PropTypeDefaultDescription
ariaLabelstringundefinedAccessibility label for screen readers
ariaLabelledbystringundefinedID reference for accessibility label
withDarkModebooleanfalseShow dark/light mode comparison UI
withIconbooleanfalseDisplay chevron icons on slider handle
  • Interactive comparison slider
  • Accessible ARIA labels
  • Dark/light mode comparison
  • Customizable handle
  • Flexible content slots
  • Responsive design
  • Base styling with Tailwind:
    .compare-container {
      @apply relative w-full max-w-lg border-2 border-primary-light-500 
            rounded-lg shadow-lg overflow-hidden;
    }
    
    .slider-handle {
      @apply absolute top-0 bottom-0 border border-primary-light-500;
    }
    
  • Dark mode styling:
    .dark-mode-overlay {
      @apply dark bg-primary-light-500;
    }
    
  • Use ariaLabel or ariaLabelledby for screen reader support
  • Keyboard navigable
  • High contrast colors
  • Semantic HTML structure
  • PUIcon for handle icons
  • Tailwind CSS for styling
  • Vue 3 Composition API