Coder Social home page Coder Social logo

andyfrantz / a8z-toggle-switch Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 73 KB

A toggle switch build with pure CSS, that can be used in forms as input checkboxes.

Home Page: https://andyfrantz.github.io/a8z-toggle-switch/

License: MIT License

SCSS 100.00%
checkbox css scss toggle-switch

a8z-toggle-switch's Introduction

toggle-switch by a8z

Release Size Stars Issues License

A toggle switch build with pure CSS, that can be used in forms as input checkboxes.

Preview

Installation

CSS

<link rel="stylesheet" href="build/toggle-switch.css">

HTML

<label class="a8z-toggle-switch">
	<input checked type="checkbox" id="ID_HERE">
	<span class="toggle">
		<span class="switch"></span>
	</span>
</label>

Options

Option Data Attribute
Rounded data-style="rounded"
Square data-style="square"
No Text data-text="false"
Disabled add the disabled attribute to the input tag
Checked add the checked attribute to the input tag
Sizes data-size="xl"
data-size="lg"
medium (default)
data-size="sm"
data-size="xs"
Colors data-color="red"
data-color="orange"
data-color="yellow"
data-color="green"
data-color="blue"
data-color="purple"
data-color="gray"
data-color="brown"
data-color="pink"
data-color="indego"
data-color="teal"
Labels data-label="left"
label on right (default)
content text / width use the style attribute to modify the css variables
style="--a8z-ts-input-checked-content:'VISIBLE'; --a8z-ts-input-unchecked-content: 'HIDDEN'; --a8z-ts-width: 90px;"

Features

  • CSS only - no JavaScript!
  • No dependencies
  • Fully reponsive
  • Fully customizable (change input content text / widht)
  • Fully self contained
  • 11 color schemes
  • Labels on the left and the right
  • Keyboard Accessible - accessibility (a11y)
  • Focus Styles - accessibility (a11y)
  • Supports all modern browsers
  • Search engine friendly
  • Screen reader friendly
  • Doesn't dump a bunch of global styles that'll screw with your other CSS
  • Everything is customizable with scss variables if using the scss source file
  • Everything is customizable if overwriting the css variables in the a8z-toggle-switch class

a8z-toggle-switch's People

Contributors

andyfrantz avatar

Stargazers

 avatar  avatar

Watchers

 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.