Skip to content

michaelbull/aurelia-split-pane

Repository files navigation

aurelia-split-pane

npm License

A custom element for resizable split panes.

A running demonstration can be found here.

Browser Support

Tested to work on the following browser versions:

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Opera
Opera
Edge 29+ 32+ 20+

Installation

Install the package via npm:

npm install --save aurelia-split-pane

Install the plugin in your Aurelia project:

export function configure(aurelia: Aurelia): void {
    aurelia.use.plugin(PLATFORM.moduleName('aurelia-split-pane'));
}

For jspm (v16 tested), add the following to your systemjs config.js file

"aurelia-split-pane": {
    "map": {
      "./split-pane": "./dist/split-pane",
      "./split-pane-divider": "./dist/split-pane-divider"
    }
  }

Import the Sass stylesheet:

@import '~aurelia-split-pane/style';

For aurelia components that make use of this component, you can import the css stylesheet in your HTML component template like so:

<require from="aurelia-split-pane/dist/split-pane.css"></require>

Usage

The demo contains two simple usage examples.

Below are a couple of simple examples:

<split-pane direction="horizontal">
  <div>Left</div>
  <div>Right</div>
</split-pane>
<split-pane direction="vertical" style="height: 500px; text-align: center;">
  <div>North</div>
  <split-pane direction="horizontal">
    <div>West</div>
    <div>Center</div>
    <div>East</div>
  </split-pane>
  <div>South</div>
</split-pane>

Usage with Viewports

Viewport configurations are an effective way of decoupling sections of your application, and can be used in conjunction with aurelia-split-pane, where each pane is effectively a viewport. An example of a message inbox, where the list of contacts and list of messages are both distinct viewports, is available here. The inbox view demonstrates how to use the <router-view> element as a pane within a <split-pane> element. Aurelia team member Matthew James Davis has an article providing an in-depth look into viewports, found here.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

This project is available under the terms of the ISC license. See the LICENSE file for the copyright information and licensing terms.