Socket
Socket
Sign inDemoInstall

@bulatdashiev/svelte-slider

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bulatdashiev/svelte-slider

Simple range slider for Svelte 3


Version published
Weekly downloads
967
increased by6.73%
Maintainers
1
Install size
71.7 kB
Created
Weekly downloads
 

Readme

Source

svelte-slider

Simple svelte range slider component. demo

Install

Install with npm or yarn:

npm i -D @bulatdashiev/svelte-slider

Then import Slider component to your Svelte app.

import Slider from '@bulatdashiev/svelte-slider';

Usage

Simple usage

<Slider bind:value >

Range input

<Slider bind:value range />

Min, max and step

<Slider min="-50" max="50" step="10" bind:value range />

You can bind to min, max and value, slider will change according to props change

Slots

Default slot

<Slider bind:value>
  <span style="font-size: 20px;">&#128079;</span>
</Slider>

Left, right slots

<Slider bind:value range>
  <span slot="left" style="font-size: 20px;">&#128078;</span>
  <span slot="right" style="font-size: 20px;">&#128077;</span>
</Slider>

Props

NameTypeDefaultDescription
valueArray [number, number][min, max]
minnumber0
maxnumber100
stepnumber1
nameArray [string, string]empty arrayProvide names to inputs if you want use slider in form input
rangebooleanfalseSet to true to use range input
orderbooleanfalseSet to true if you want value[0] always be greater then value[1]

Slots

  • default - customizes both thumbs if left or right slots isn't provided
  • left - provide to customize left thumb
  • right - provide to customize right thumb

Events

  • input - event fires when the value changes within thumb drag

Style

:root {
  --track-bg: #ebebeb;
  --progress-bg: #8abdff;
  --thumb-bg: #5784fd;
}

set --thumb-bg to transparent if you use custom thumb

:root {
  --thumb-bg: transparent;
}

License

MIT © BulatDashiev

Keywords

FAQs

Last updated on 24 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc