vue3-columns-resizable

Vue 3 directive to resize HTML table columns
5,084 1
Install
npm install vue3-columns-resizable
Latest Version:1.0.6
Vue:3
License:MIT
Last Updated:Oct 21, 2026
Links: GitHub  ·  npm
Maintainer: rizwanulrudra

vue3-columns-resizable

Vue 3 directive to make <table> and <thead> columns resizable.

📝 About

This package is a Vue 3 upgrade of the original vue-columns-resizable by Fuxy526.

This version has been rewritten in TypeScript for Vue 3 with Vite support. Licensed under the MIT License.

🚀 Install

yarn add vue3-columns-resizable
# or
npm install vue3-columns-resizable

🚀 Quick Start

// main.ts or entry file
import { createApp } from 'vue'
import App from './App.vue'
import vue3ColumnsResizable from 'vue3-columns-resizable'

const app = createApp(App)
app.use(vue3ColumnsResizable)
app.mount('#app')

🧩 Usage

You can use the v-columns-resizable directive on either:

<table> — to apply resizing globally

<thead> — to apply resizing only on header

<script setup>
function onColumnResized(event) {
  console.log('Column resized:', event.detail)
  // {
  //   index: number,        // current column index
  //   width: number,        // new width of the current column (px)
  //   nextIndex: number,    // index of the next column
  //   nextWidth: number     // new width of the next column (px)
  // }
}
</script>

<template>
  <table class="resizable-table" v-columns-resizable @column-resized="onColumnResized">
    <thead>
      <tr>
        <th width="50%">Name</th>
        <th width="25%">Age</th>
        <th width="25%">Gender</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>20</td>
        <td>Male</td>
      </tr>
      <tr>
        <td>Emma</td>
        <td>18</td>
        <td>Female</td>
      </tr>
    </tbody>
  </table>
</template>

📡 Events

Event Description Payload (event.detail)
column-resized Emitted during drag when column size changes { index, width, nextIndex, nextWidth } – all values in pixels

⚙️ Advanced Notes

  • Widths are updated via inline style.width in pixels.

  • There is no min-width restriction enforced by default. You may enforce it manually.

  • You can listen to column-resized to persist layout changes, e.g., save to localStorage or backend.

🧑‍💻 Development

To build the library:

yarn build

To run the demo app in dev mode:

yarn dev

To run the tests:

yarn test

🔗 License & Attribution

This project is licensed under the MIT License © 2025.

Originally created by Fuxy526 as vue-columns-resizable for Vue 2.
This is a Vue 3-compatible rewrite and extension by riz007.

Related Packages

vue-directive-window

Vue.js directive that enhance your Modal Window, support drag, resize and maximi...

1,359 31
v-resizable

Vue directive for resizable elements

25,554 16
@vuecs/table

Compound table for vuecs (Table / Header / Body / Footer / Row / Cell / HeadCell...

6,618 4
vue3-highlight-text

a vue3 directive of highlight text

84,789
vue-proportion-directive

vue 固定元素比例指令

6,003 10

Version History

Version Released Vue License
1.0.6 3.5.39 MIT
1.0.5 3.5.39 MIT
1.0.4 3.5.39 MIT
1.0.3 ^3.5.13 MIT
1.0.1 ^3.5.13 MIT