uiv: Bootstrap 3 Components for Vue 3

2.0.6 · active · verified Sun Apr 19

uiv is a lightweight collection of Bootstrap 3 components meticulously re-implemented for Vue.js. The current stable version, 2.0.6, targets Vue 3, while previous 1.x versions supported Vue 2. The library is actively maintained with frequent bug fix releases, as seen in the recent 2.0.x updates. Key differentiators include its small bundle size (approximately 20KB gzipped for all components), absence of an additional CSS file (relying on Bootstrap's own styles), support for individual component imports to minimize payload, and compatibility with Server-Side Rendering (SSR). It provides a comprehensive set of common UI elements like Modals, Tabs, Dropdowns, and more, enabling developers to build Bootstrap-styled interfaces using Vue's reactivity system. This library aims to provide a native Vue experience for Bootstrap 3, distinguishing itself from wrappers that might rely on jQuery or other external dependencies for component logic.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize uiv as a Vue 3 plugin and use a basic modal component, highlighting the necessity of importing Bootstrap's CSS.

import 'bootstrap/dist/css/bootstrap.min.css'
import { createApp, h } from 'vue'
import * as uiv from 'uiv'

const App = {
  template: `
    <div class="container">
      <h1>uiv Example</h1>
      <button type="button" class="btn btn-primary" @click="showModal = true">
        Open Modal
      </button>
      <uiv-modal v-model="showModal" title="Hello uiv!" @hide="onModalHide">
        This is a simple modal dialog using uiv components. Ensure Bootstrap CSS is imported!
        <template #footer>
          <button type="button" class="btn btn-default" @click="showModal = false">Close</button>
          <button type="button" class="btn btn-primary" @click="showAlert">Do Something</button>
        </template>
      </uiv-modal>
    </div>
  `,
  data() {
    return {
      showModal: false
    }
  },
  methods: {
    onModalHide() {
      console.log('Modal was hidden')
    },
    showAlert() {
      alert('Action taken!')
      this.showModal = false
    }
  }
}

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

view raw JSON →