npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-switchery-ios

v2.9.12

Published

[![npm version](https://badge.fury.io/js/angular-switchery-ios.svg)](https://badge.fury.io/js/angular-switchery-ios) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/zainzafar90/angular-switchery-ios/blob/master/LICE

Downloads

1,354

Readme

Angular Switchery IOS

npm version MIT licensed

Description

This package is an angular based component that helps you use beautiful switchery controls WITHOUT any external JavaScript dependency. Number of customizations are available to suit your needs including colors, sizes, labels & positioning.

Supported by all modern browsers: Chrome, Firefox, Opera, Safari, Edge

Preview

Live Preview

Installation

To install this library, run:

$ npm install angular-switchery-ios --save

Consuming your library

You can import library in Angular AppModule by the following method:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

import { AppComponent } from "./app.component";

import { NgSwitcheryModule } from "angular-switchery-ios";

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,

    // Specify your library as an import
    NgSwitcheryModule,
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}

Once your library is imported, you can use Switchery in your Angular application:

Usage

Settings and Defaults

  • color : color of the switch element (default is primary, switchery-info, switchery-success, switchery-warning, switchery-danger)
  • size : size of the switch element (switchery-lg, switchery-sm, switchery-xs)
  • disabled : you can enable/disable states the state of the switch by adding disabled property (boolean value)
  • onLabel : specify label for your switch
  • offLabel : specify label for your switch
  • sticked : position your switch to stick to right (boolean value)

Examples

Default

<!-- Default Switch -->
<ng-switchery [(ngModel)]="truthyValue"></ng-switchery>

Template Driven Froms

Using ng-switchery withing a template driven form or with NgModel

<!-- Template Driven Form -->

<form #form="ngForm">
  <ng-switchery [(ngModel)]="truthyValue" name="switchery-check"></ng-switchery>
</form>

Reactive Forms

Using ng-switchery within a Reactive Forms

<form [formGroup]="reactiveForm">
  <ng-switchery formControlName="value"></ng-switchery>
</form>

Disable

Enable/Disable states by adding disabled property

<!-- Checked Disabled -->
<ng-switchery
  [(ngModel)]="truthyValue"
  disabled
  onLabel="Checked Disabled"
></ng-switchery>

<!-- Unchecked Disabled -->
<ng-switchery
  [(ngModel)]="falsyValue"
  disabled
  onLabel="Unchecked Disabled"
></ng-switchery>

Colored

Change the default color of the switch to fit your design perfectly. According to the color system, any of its color can be applied to the switchery.

<!-- No class specified -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Checked in Primary"
></ng-switchery>

<!-- color = switchery-info -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Checked in Info"
  color="switchery-info"
></ng-switchery>

<!-- color = switchery-success -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Checked in Success"
  color="switchery-success"
></ng-switchery>

<!-- color = switchery-warning -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Checked in Warning"
  color="switchery-warning"
></ng-switchery>

<!-- color = switchery-danger -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Checked in Danger"
  color="switchery-danger"
></ng-switchery>

Sized

Choose one of 4 main Switch sizes - large ( .switchery-lg), default, small ( .switchery-sm) and mini ( .switchery-xs). Just add proper size as input.

<!-- size = switchery-lg -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Large in size"
  size="switchery-lg"
></ng-switchery>

<!-- No size specified -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Default in size"
></ng-switchery>

<!-- size = switchery-sm -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Small in size"
  size="switchery-sm"
></ng-switchery>

<!-- size = switchery-xs -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Mini in size"
  size="switchery-xs"
></ng-switchery>

Labels

Switchery can be used with single label or with multiple labels. For single label use onLabel="Single Label", for double specify an extra property offLabel="Double Label"

<!-- Specify onLabel  -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Single Label Switch"
></ng-switchery>

<!-- Specify both onLabel & offLabel -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Option 1"
  offLabel="Option 2"
></ng-switchery>

Right Sticked

Sometimes it's very useful to have switches on the right side of the container. Just add [sticked]="true" to the Switchery

<!-- Set sticked = true -->
<ng-switchery
  [(ngModel)]="truthyValue"
  onLabel="Option 1"
  sticked="true"
></ng-switchery>

License

MIT © Zain Zafar