New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

svelte-dock

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-dock

Svelte dock component

0.0.1-dev.0
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

svelte-dock

NPM npm bundle size (minified + gzip)

SvelteJS component for switch or toggle a boolean. User would be able to drag or click for toggling.

Demo

Click here for Storybook link

REPL Link

Installation

npm install svelte-dock

or

yarn add svelte-dock

Usage

<script>
  import Switch from "svelte-dock";

  let checkedValue = true;

  function handleChange(e) {
    const { checked } = e.detail;
    checkedValue = checked;
  }
</script>

<h1>Simple usage</h1>
Switch with default style
<Switch on:change={handleChange} checked={checkedValue} />
<br />
The switch is {checkedValue ? 'on' : 'off'}.

API

Props

Prop NameDescriptionDefault Value
checkedRequired fieldundefined
disabledfalse
offColor"#888"
onColor"#080"
offHandleColor"#fff"
onHandleColor"#fff"
handleDiameter0
boxShadownull
activeBoxShadow"0 0 2px 3px #3bf"
height28
width56
id''
containerClass''

Slots

Slot NameDescriptionDefault Set?
checkedIconYes
unCheckedIconYes

Events

Event NameDescriptionevent.detail info
change{event: event, checked}

Examples

Click here to view stories implementation

Credits

Component is reimplementation react-switch. Complete credit goes to author and contributors of react-switch.

License

MIT

Keywords

svelte

FAQs

Package last updated on 13 Sep 2020

Did you know?

Socket

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