GithubHelp home page GithubHelp logo

hhy5277 / vue-multipane Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yansern/vue-multipane

0.0 1.0 0.0 556 KB

Resizable split panes for Vue.js.

Home Page: https://yansern.github.io/vue-multipane/

License: Other

JavaScript 88.91% HTML 1.26% Vue 9.83%

vue-multipane's Introduction

vue-multipane npm tag

Resizable split panes for Vue.js.


Check out the live demo.

Features

  • Uses CSS3 Flexbox.
  • Supports vertical & horizontal layouts.
  • Supports fixed and fluid panes.
  • Configure everything using CSS!

Installation

$ npm install vue-multipane

Using vue-multipane

First, import vue-multipane into your Vue component.

import { Multipane, MultipaneResizer } from 'vue-multipane';

export default {
  // ...
  components: {
    MultiPane,
    MultiPaneResizer
  }
}

Then, construct your split pane layout using multipane component.

<multipane>
  <div>Pane 1</div>
  <multipane-resizer></multipane-resizer>
  <div>Pane 2</div>
  <multipane-resizer></multipane-resizer>
  <div>Pane 3</div>
</multipane>

Customizing pane layout

You can customize pane layouts using CSS.

  • Create vertical/horizontal layouts using layout="vertical|horizontal" attribute.
  • Set initial pane size using width|height CSS property.
  • Set pane size constraints using min-width|min-height|max-width|max-height CSS property.
  • Create fixed/fluid combination panes by using px|% units.
  • Use flex-grow: 1 for that one pane that should take all remaining space available on the multipane container.

This example below shows a combination of different styling properties you can apply to make the panes render the way you want it to:

<multipane class="foo" layout="vertical">
  <div :style="{ width: '100px', maxWidth: '200px' }">Pane 1</div>
  <multipane-resizer></multipane-resizer>
  <div :style="{ width: '25%', maxWidth: '50%' }">Pane 2</div>
  <multipane-resizer></multipane-resizer>
  <div :style="{ flexGrow: 1 }">Pane 3</div>
</multipane>

Customizing resize handle

By default, vue-multipane creates an invisible 10px resize handle that sits in between 2 panes. You can customize the appearance of the resize handle to fit your needs.

This example below creates a 15px blue resize handle:

.multipane.foo.layout-v .multipane-resizer {
  margin: 0; left: 0; /* reset default styling */
  width: 15px;
  background: blue;
}

.multipane.foo.layout-h .multipane-resizer {
  margin: 0; top: 0; /* reset default styling */
  height: 15px;
  background: blue;
}

Optional resize handle

You can also add resize handle only specific panes by just adding <multipane-resizer> next it.

<multipane>
  <div>Pane 1</div> <!-- No resizing on Pane 1. -->
  <div>Pane 2</div> <!-- Resizing is possible on Pane 2. -->
  <multipane-resizer></multipane-resizer>
  <div>Pane 3</div>
</multipane>

Options

** Multipane **

Property Description Type Default
layout Determine layout of panes. String [vertical, horizontal] vertical

Events

** Multipane **

Event Description Returns
paneresizestart When user clicks on the resize handle to start resizing a pane. pane, container, size
paneresize When user is resizing a pane. pane, container, size
paneresizestop When user release the resize handle to stop resizing a pane. pane, container, size

License

vue-multipane by Yan Sern licensed under MIT.

PS: I would love to know if you're using vue-multipane. Tweet to me at @yansernio.

vue-multipane's People

Contributors

yansern 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.