Skip to content

Instantly share code, notes, and snippets.

@angjez
Last active July 25, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angjez/3109c1ce9b821a4bab46ab9f9744b89a to your computer and use it in GitHub Desktop.
Save angjez/3109c1ce9b821a4bab46ab9f9744b89a to your computer and use it in GitHub Desktop.
<ToggleCircle
style={{ x }} // this will change the coordinate of the wrapper as you drag
drag="x" // drag direction
dragConstraints={{ left: -100, right: 100 }} // depends how long of a drag you want to allow
dragSnapToOrigin={true} // will bring the wrapper back to the center upon release
dragElastic={0.1} // adds a more natural feel
whileDrag={{ scale: 1.3 }}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment