Skip to content

arrowtype/svelte-slider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple SvelteJS slider component

To use SvelteJS, please see the SvelteJS Documentation.


This Slider component:

  • Has custom CSS which makes it easy to manipulate on a touch screen, while still looking simple & similar across platforms. This takes a lot of CSS for a range input.
  • Is separate from the main app component, which is nice because it has custom CSS that only has to be written once. (It’s a component.)
  • Has props for value, min, & max. It also spreads in additional props you might wish to pass in, such as step.
  • Works just like a normal, plain-HTML range input does in Svelte. You can easily bind its value to the state in the component it is used within.

Note: this is intended mostly as a test & shared example of how a Slider component can be made in SvelteJS. It is not necessarily representative of best practices in Svelte, and it is probably not something that you should reuse without testing & improvement.

Thanks to Stack Overflow user @Gh05d for good advice on simplifying this component.

Have an idea of how to improve it? Please file an issue or make a pull request in the GitHub Repo!

About

A simple example of a slider component for SvelteJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published