GithubHelp home page GithubHelp logo

kcmr / liquid-switch Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.57 MB

Web Component that acts as a checkbox with the appearance of a switch

License: MIT License

HTML 64.71% JavaScript 19.24% CSS 16.05%
web-components custom-elements polymer checkbox switch switch-control a11y

liquid-switch's Introduction

<liquid-switch>

Published on webcomponents.org

Demo and API docs

<liquid-switch> is a custom element that acts as a checkbox and has the appearance of a switch.

<liquid-switch checked>Switch label</liquid-switch>

Installation and usage

  1. Install the component using Bower:
$ bower liquid-switch i -S
  1. Import Web Components polyfill:
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  1. Import Custom Element:
<link rel="import" href="bower_components/liquid-switch/liquid-switch.html">
  1. Use it!:
<liquid-switch checked>Switch label</liquid-switch>

Styling

The following custom properties and mixins are available for styling.

Note: all the values are unitless but border-radius.

Custom property Description Default
--liquid-switch-switch-background-color Background color of the switch #f5f5f5
--liquid-switch-switch-width Switch width 40
--liquid-switch-switch-padding Padding between switch and knob 3
--liquid-switch-border-radius border-radius of the switch 10px
--liquid-switch-knob-color-on Knob checked color #7eb30f
--liquid-switch-knob-color-off Knob unchecked color #aeb5ae
--liquid-switch-knob-size Size of the knob (width and height) 16
--liquid-switch-bar Empty mixin applied to the switch {}
--liquid-switch-knob Empty mixin applied to the knob {}

liquid-switch's People

Contributors

kcmr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.