🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

vue-allotment

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-allotment

Vue 3 port of React Allotment - resizable split views with draggable dividers

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
1
-80%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Allotment

A Vue 3 port of the popular React Allotment component library. This library provides resizable split views for Vue applications, perfect for creating complex layouts with draggable dividers.

npm version License: MIT

Features

  • 🎯 Vue 3 Composition API - Built with modern Vue 3 and TypeScript
  • 📱 Responsive - Works on desktop and mobile devices
  • 🎨 Customizable - Full CSS customization support
  • đź”§ TypeScript - Complete type safety and IntelliSense
  • ⚡ Performant - Optimized for smooth interactions
  • đź§© Flexible - Supports horizontal, vertical, and nested layouts

Installation

npm install vue-allotment
# or
pnpm add vue-allotment
# or
yarn add vue-allotment

Quick Start

<script setup>
import { Allotment, Pane } from 'vue-allotment'
import 'vue-allotment/style.css'
</script>

<template>
  <Allotment>
    <Pane>
      <div>Left Panel</div>
    </Pane>
    <Pane>
      <div>Right Panel</div>
    </Pane>
  </Allotment>
</template>

Basic Usage

Horizontal Split (Default)

<template>
  <Allotment>
    <Pane min-size="{200}">
      <div>Left side</div>
    </Pane>
    <Pane>
      <div>Right side</div>
    </Pane>
  </Allotment>
</template>

Vertical Split

<template>
  <Allotment vertical>
    <Pane>
      <div>Top panel</div>
    </Pane>
    <Pane>
      <div>Bottom panel</div>
    </Pane>
  </Allotment>
</template>

Custom Sizes

<template>
  <Allotment :default-sizes="[200, 300, 100]">
    <Pane>
      <div>200px wide</div>
    </Pane>
    <Pane>
      <div>300px wide</div>
    </Pane>
    <Pane>
      <div>100px wide</div>
    </Pane>
  </Allotment>
</template>

Component Props

Allotment Props

PropTypeDefaultDescription
defaultSizesnumber[]-Initial sizes for each pane
verticalbooleanfalseSplit direction
separatorbooleantrueShow separator between panes
proportionalLayoutbooleantrueResize proportionally
minSizenumber30Global minimum pane size
maxSizenumberInfinityGlobal maximum pane size
snapbooleanfalseEnable snapping to zero
classNamestring-Custom CSS class

Pane Props

PropTypeDefaultDescription
minSizenumber-Minimum size for this pane
maxSizenumber-Maximum size for this pane
preferredSizenumber | string-Preferred size (px or %)
priority'Normal' | 'Low' | 'High''Normal'Resize priority
snapbooleanfalseEnable snapping for this pane
visiblebooleantruePane visibility
classNamestring-Custom CSS class

Events

<script setup>
function onSizeChange(sizes) {
  console.log('New sizes:', sizes)
}

function onDragStart(sizes) {
  console.log('Drag started with sizes:', sizes)
}

function onDragEnd(sizes) {
  console.log('Drag ended with sizes:', sizes)
}

function onReset() {
  console.log('Panes were reset')
}
</script>

<template>
  <Allotment
    @change="onSizeChange"
    @drag-start="onDragStart"
    @drag-end="onDragEnd"
    @reset="onReset"
  >
    <!-- panes -->
  </Allotment>
</template>

Programmatic Control

<script setup>
import { ref } from 'vue'
import { Allotment, Pane } from 'vue-allotment'

const allotmentRef = ref()

function reset() {
  allotmentRef.value?.reset()
}

function resize() {
  allotmentRef.value?.resize([300, 400])
}
</script>

<template>
  <div>
    <button @click="reset">
      Reset
    </button>
    <button @click="resize">
      Custom Resize
    </button>

    <Allotment ref="allotmentRef">
      <Pane>Panel 1</Pane>
      <Pane>Panel 2</Pane>
    </Allotment>
  </div>
</template>

Styling

The component uses CSS modules and provides CSS custom properties for theming:

:root {
  --focus-border: #007fd4;
  --separator-border: rgba(128, 128, 128, 0.35);
  --sash-size: 8px;
  --sash-hover-size: 4px;
  --sash-hover-transition-duration: 0.1s;
}

Development

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Build for production
pnpm build

# Run type checking
pnpm vue-tsc

Credits

This Vue port is based on the excellent Allotment React library by John Walley.

License

MIT

Keywords

vue

FAQs

Package last updated on 11 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts