Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gbuomprisco/ng2-expansion-panels

Expansion Panels component for Angular 2
https://github.com/gbuomprisco/ng2-expansion-panels

angular angular-components expansion-panels material-design

Last synced: about 2 months ago
JSON representation

Expansion Panels component for Angular 2

Awesome Lists containing this project

README

        

# Ng2 Expansion Panels [![Build Status](https://travis-ci.org/Gbuomprisco/ng2-expansion-panels.svg?branch=master)](https://travis-ci.org/Gbuomprisco/ng2-expansion-panels)

This is a component for Angular 2. Design is inspired by Material Design's component Expansion Panels.

**Development is in very early stage**

## Demo
Check out the live demo (with source code) here [http://www.buompris.co/ng2-expansion-panels](http://www.buompris.co/ng2-expansion-panels).

## Installing

npm install ng2-expansion-panels --save

## Configuration

Ensure you import the module:

```javascript
import { ExpansionPanelsModule } from 'ng2-expansion-panels';

// please notice this is the new way of telling a Component
// to import another component...no more directives[]
@NgModule({
imports: [ExpansionPanelsModule]
})
export class MyModule {}
```

## API
- **`onOpen`** - [**`?onOpen(panel: ExpansionPanelComponent)`**] - event fired when a panel is opened
- **`onClose`** - [**`?onClose(panel: ExpansionPanelComponent)`**] - event fired when a panel is closed
- **`onSubmit`** - [**`?onSubmit()`**] - event fired when `submit` is called
- **`onCancel`** - [**`?onCancel()`**] - event fired when `cancel` is called

## Examples
### Basic Example

```html



Title


Description when hidden


Description when toggled


Content

...
...
...

```

### Add Buttons to a panel

Every panel has already defined two methods, `cancel` and `submit`. In order to bind those
to the buttons we define, we need to create a reference to the panel. In this example, I called it `#panel`
and them I'm calling panel.cancel() and panel.submit().

It is possible to listen to these events with the outputs `onCancel` and `onSubmit`.

```html



Title


Description when hidden


Description when toggled


Content


Cancel
Submit

```