Git Product home page Git Product logo

ng2-material-dropdown's Introduction

Angular2 Dropdown Component

Material-like dropdown component for Angular2.

Install

npm install ng2-material-dropdown --save

Demo

Check out the demo at http://www.buompris.co/ng2-material-dropdown

Usage

Once installed, import the directives and use it them your container component:

<ng2-dropdown>
    <ng2-dropdown-button>
        Open Menu
    </ng2-dropdown-button>
    <ng2-dropdown-menu>
        <ng2-menu-item *ngFor="let page of pages">
            {{ page }}
        </ng2-menu-item>

        <div class='ng2-menu-divider'></div>

        <ng2-menu-item>
            With Divider
        </ng2-menu-item>
    </ng2-dropdown-menu>
</ng2-dropdown>
// import module
import { Ng2DropdownModule } from 'ng2-material-dropdown';

@NgModule({
    imports: [ Ng2DropdownModule ]
    // ..
})
export class MyModule {}

API

ng2-dropdown

  • dynamicUpdate - [?boolean] : option to disable the dynamic update of the position on scroll events (defaults to true)
  • onItemSelected() - [(onItemSelected($event)] : event that emits the currently selected/hovered item
  • onItemClicked() - [(onItemClicked($event)] : event that emits the item clicked on
  • onShow() - [(onItemClicked($event)] : event that emits when the dropdown gets shown
  • onHide() - [(onItemClicked($event)] : event that emits when the dropdown gets hidden

ng2-dropdown-menu

  • focusFirstElement - [?boolean] : by default the first element is immediately focused. You can disable by setting this option to false
  • width - [?number]: this determines the width of the menu. Possible values are 2, 4 and 6. By default, this is set to 4
  • offset - [?string]: offset to adjust the position of the dropdown with absolute values
  • appendToBody - [?boolean] : by default the dropdown is appended to the body, but you can disable this by setting it to false

ng2-dropdown-button

  • showCaret - [?boolean] : if present, a caret will be appended to the button's text

ng2-menu-item

  • preventClose - [?boolean] : if present, this attribute prevents the menu to hide when the menu item is clicked
  • value - [?any] : any value that you may want to attach to a menu item. Useful for using this component with other components.

ng2-material-dropdown's People

Contributors

derkoe avatar gbuomprisco avatar jonnybgod avatar souldreamer avatar tdawgy avatar wolfgang-lausenhammer 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.