PUSwitch Component

A customizable switch (toggle) component with multiple variants, disabled states, and different widths.

Usage

Basic Usage

Toggle me
Mid style
Disabled
PropTypeRequiredDefaultDescription
modelValuebooleanYes-The current state of the switch (on/off)
disabledbooleanNofalseDisables interaction with the switch
labelstringNo''Text label displayed next to the switch
flavornormal | outlinedNonormalDefines the styling variant of the switch
widthfull | midNofullDefines the width of the switch
VariantClassesDescription
normal`pu-switch--normal`Standard filled switch (Default)
outlined`pu-switch--outlined`Switch with a border and transparent inactive state
  • Uses font-patrick font family class
  • Utility-first CSS applied for flexible styling:
    .pu-switch {
      @apply rounded-full transition-colors duration-300;
    }
    .pu-switch-thumb {
      @apply absolute bg-white rounded-full shadow-sm transform transition-transform;
    }
    
  • Hover effects apply when not disabled
  • Borders and backgrounds adjust dynamically based on the active state
  • Fully customizable through CSS classes
  • Built with Tailwind CSS utility classes
  • Fully compatible with Vue's v-model