Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 2.46 KB

README.md

File metadata and controls

55 lines (42 loc) · 2.46 KB

reusableComponents

Angular directives for UI components

Table of Contents

Motivation

reusableComponents is an AngularJS module containing directives for light, configurable UI components which can be restyled. It relies on the directives of the reusableBehaviors module.

Components

  • Checkbox - Exactly what you'd expect
  • Toggle - A slider toggle

Design Paradigm

  • Directives are named in the typical angular fashion, beginning with a two-character mnemonic, followed by a single word which is descriptive of the behavior that the directive provides. (e.g. rc-checkbox, rc-toggle)
  • Some of the directives rely on attributes for configuration, see the demos page for more details
  • Some directives depend on services, check out the demos page for more info

Usage

These directives are meant for use with the ng-class directive and a strong knowledge of CSS and CSS transitions. They can be used to provide behaviors to standalone elements, or they can be invoked inside of other directives with styles already applied, providing behavior to the contents of the container directive.

####Example

This is the source code for the rc-toggle directive.

And this is an example of the rc-toggle directive being used in the DOM

In this example, the directive is instantiated on the button and its API is defined as "window". This API is then used by the <button> element, which invokes the directive's toggle method whenever it is clicked. The result of invoking the toggle method is that the boolean window.active changes its state.

The following CSS applies a transition whenever window.toggle is invoked.

Install

Installation is very simple.

  • Include rc.js or rc.min.js file in your project directory
  • Inside of your index.html, include a <script> tag which points to rc.js or rc.min.js
  • In the declarration of your angular app, pass 'reusable-components' as a dependency, like:
angular.module('myApp', ['reusable-components']);

License

MIT License can be viewed here