
Bootstrap Vue3
- 23 installs
- 3 repo stars
- Updated July 29, 2026
- full-statck-skills/vue-ui-skills
Guidance for the Bootstrap Vue 3 component library, covering components, grid system, directives and responsive layouts.
About
Provides guidance for building Vue 3 apps with Bootstrap Vue components, grid and directives. A developer uses it when creating responsive Bootstrap-styled UIs in Vue 3.
- Covers Button, Form, Table, Modal and grid components
- Includes directives like v-b-tooltip and theme customization
Bootstrap Vue3 by the numbers
- 23 all-time installs (skills.sh)
- Ranked #1,515 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/full-statck-skills/vue-ui-skills --skill bootstrap-vue3Add your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 23 |
|---|---|
| repo stars | ★ 3 |
| Last updated | July 29, 2026 |
| Repository | full-statck-skills/vue-ui-skills ↗ |
What it does
Guidance for the Bootstrap Vue 3 component library, covering components, grid system, directives and responsive layouts.
Files
When to use this skill
Use this skill whenever the user wants to:
- Build Vue 3 applications with Bootstrap Vue components
- Use Bootstrap UI components (Button, Form, Table, Modal, etc.)
- Create responsive layouts with Bootstrap grid
- Use Bootstrap Vue directives (v-b-tooltip, v-b-popover, v-b-modal)
- Implement forms with Bootstrap styling
- Display data in Bootstrap tables
- Create modals and alerts
- Use Bootstrap navigation components
- Customize Bootstrap themes
- Migrate from Bootstrap Vue 2.x to 3.0
How to use this skill
This skill is organized to match the Bootstrap Vue 3.0 official documentation structure (https://bootstrap-vue.org/docs, https://bootstrap-vue.org/docs/components). When working with Bootstrap Vue 3.0:
1. Identify the topic from the user's request:
- Getting started/快速开始 →
examples/getting-started/installation.mdorexamples/getting-started/basic-usage.md - Button/按钮 →
examples/components/button.md - Form/表单 →
examples/components/form.md - Table/表格 →
examples/components/table.md - Modal/模态框 →
examples/components/modal.md - Alert/警告框 →
examples/components/alert.md - Navbar/导航栏 →
examples/components/navbar.md - Grid/栅格 →
examples/components/grid.md - Directives/指令 →
examples/directives/tooltip.mdorexamples/directives/modal.md
2. Load the appropriate example file from the examples/ directory:
Getting Started (快速开始) - `examples/getting-started/`:
examples/getting-started/installation.md- Installing Bootstrap Vue and basic setupexamples/getting-started/basic-usage.md- Basic component usage
Components (组件) - `examples/components/`:
examples/components/button.md- Button componentexamples/components/form.md- Form componentsexamples/components/input.md- Input componentexamples/components/table.md- Table componentexamples/components/modal.md- Modal componentexamples/components/alert.md- Alert componentexamples/components/navbar.md- Navbar componentexamples/components/grid.md- Grid system (Container, Row, Col)examples/components/card.md- Card componentexamples/components/badge.md- Badge componentexamples/components/dropdown.md- Dropdown componentexamples/components/pagination.md- Pagination componentexamples/components/tabs.md- Tabs componentexamples/components/collapse.md- Collapse componentexamples/components/popover.md- Popover componentexamples/components/tooltip.md- Tooltip component
Directives (指令) - `examples/directives/`:
examples/directives/tooltip.md- v-b-tooltip directiveexamples/directives/popover.md- v-b-popover directiveexamples/directives/modal.md- v-b-modal directiveexamples/directives/toggle.md- v-b-toggle directive
Advanced (高级) - `examples/advanced/`:
examples/advanced/theme-customization.md- Customizing Bootstrap themeexamples/advanced/composables.md- Using composables (useToast, useModal)
3. Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- All examples follow Bootstrap Vue 3.0 API (Vue 3 + Bootstrap 5)
- Examples use Composition API syntax
- Each example file includes key concepts, code examples, and key points
- Always check the example file for best practices and common patterns
4. Reference API documentation in the api/ directory when needed:
api/components.md- Component API referenceapi/directives.md- Directives API referenceapi/composables.md- Composables API reference
5. Use templates from the templates/ directory:
templates/project-setup.md- Project setup templatestemplates/component-template.md- Component usage templates
Doc mapping (one-to-one with official documentation)
Guide (指南):
- See guide files in
examples/guide/orexamples/getting-started/→ https://bootstrap-vue.org/docs
Components (组件):
- See component files in
examples/components/→ https://bootstrap-vue.org/docs/components
Examples and Templates
This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).
To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/directory for common scaffolding - Adapt templates to your specific needs and coding style
API Reference
Detailed API documentation is available in the api/ directory, organized to match the official Bootstrap Vue 3.0 API documentation structure:
Components API (api/components.md)
- All component props and APIs
- Component events and slots
- Component types and interfaces
Directives API (api/directives.md)
- Directive syntax and usage
- Directive modifiers
- Directive options
Composables API (api/composables.md)
- useToast composable
- useModal composable
- usePopover composable
To use API reference: 1. Identify the API you need help with 2. Load the corresponding API file from the api/ directory 3. Find the API signature, parameters, return type, and examples 4. Reference the linked example files for detailed usage patterns 5. All API files include links to relevant example files in the examples/ directory
Best Practices
1. Import Bootstrap CSS: Import Bootstrap CSS in your entry file 2. Use Composition API: Prefer Composition API for Vue 3 projects 3. Tree-shaking: Import components individually for better tree-shaking 4. Responsive design: Use Bootstrap grid system for responsive layouts 5. Accessibility: Follow Bootstrap accessibility guidelines 6. Theme customization: Use Bootstrap variables for consistent theming 7. Directives: Use directives for programmatic component control 8. Composables: Use composables for programmatic API access 9. Component composition: Compose components for complex UIs 10. Performance: Optimize bundle size with tree-shaking
Resources
- Official Website: https://bootstrap-vue.org
- Documentation: https://bootstrap-vue.org/docs
- Components: https://bootstrap-vue.org/docs/components
- GitHub Repository: https://github.com/bootstrap-vue/bootstrap-vue-next
Keywords
Bootstrap Vue, Bootstrap Vue 3.0, Vue 3, Bootstrap 5, components, Button, Form, Table, Modal, Alert, Navbar, Grid, directives, v-b-tooltip, v-b-popover, v-b-modal, composables, useToast, useModal, 组件库, 按钮, 表单, 表格, 模态框, 警告框, 导航栏, 栅格, 指令
能力边界
✅ 适用场景
- 当你需要使用此技能对应的技术栈时
- 当项目需要遵循最佳实践时
- 当需要快速上手或深入理解核心概念时
⚠️ 需要注意
- 复杂业务逻辑需要结合具体场景调整
- 性能优化需要根据实际数据量评估
❌ 不适用场景
- 不相关的技术栈或框架
- 需要完全自定义的特殊场景
常见陷阱 (Gotchas)
1. 版本兼容性:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 2. 配置文件格式:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 3. 环境变量:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 4. 依赖冲突:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 5. 性能陷阱:大数据量场景下注意性能优化,避免 N+1 查询等常见问题
使用流程
Step 1: 环境准备
确保开发环境已安装必要的依赖和工具。
Step 2: 配置初始化
根据项目需求进行基础配置。
Step 3: 核心功能使用
按照示例代码实现核心功能。
Step 4: 测试验证
运行测试确保功能正常。
Step 5: 部署上线
完成开发后进行部署和监控。
Components API | 组件 API
API Reference
Bootstrap Vue 3.0 component APIs and props.
Common Props
Most components share common props:
variant: Component variant (primary, success, danger, etc.)size: Component size (sm, md, lg)disabled: Disabled stateclass: Additional CSS classes
Button API
Props:
variant: Button variant (primary, success, danger, warning, info, light, dark)size: Button size (sm, md, lg)disabled: Disabled statetype: Button type (button, submit, reset)onClick: Click handler
Form API
Props:
@submit: Submit handler@reset: Reset handler
Form.Input Props:
v-model: Input valuetype: Input type (text, email, password, etc.)placeholder: Placeholder textrequired: Required field:state: Validation state
Table API
Props:
items: Table data arrayfields: Column definitionssortable: Enable sortingselectable: Enable row selectionselect-mode: Selection mode (single, multi)v-model:selected: Selected rows
Modal API
Props:
v-model: Modal visibilitytitle: Modal titlesize: Modal size (sm, lg, xl)@ok: OK button handler@cancel: Cancel button handler
Methods:
show(): Show modalhide(): Hide modal
Grid API
Container Props:
fluid: Fluid container
Row Props:
align-v: Vertical alignmentalign-h: Horizontal alignment
Col Props:
cols: Column widthsm,md,lg,xl,xxl: Responsive widthsoffset: Column offset
Key Points
- All components support variant and size props
- Form components use v-model for two-way binding
- Table uses items and fields pattern
- Modal uses v-model for visibility control
- Grid system follows Bootstrap 5 breakpoints
Button | 按钮
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use the Button component in Bootstrap Vue 3.0.
Key Concepts
- Button variants (primary, success, danger, etc.)
- Button sizes (sm, md, lg)
- Button states (disabled, loading)
- Button with icons
- Button groups
Example: Button Variants
<template>
<div>
<BButton variant="primary">Primary</BButton>
<BButton variant="success">Success</BButton>
<BButton variant="danger">Danger</BButton>
<BButton variant="warning">Warning</BButton>
<BButton variant="info">Info</BButton>
<BButton variant="light">Light</BButton>
<BButton variant="dark">Dark</BButton>
</div>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Button Sizes
<template>
<div>
<BButton variant="primary" size="lg">Large</BButton>
<BButton variant="primary">Default</BButton>
<BButton variant="primary" size="sm">Small</BButton>
</div>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Button with Icon
<template>
<BButton variant="primary">
<BIcon icon="search" />
Search
</BButton>
</template>
<script setup>
import { BButton, BIcon } from 'bootstrap-vue-next'
</script>Example: Disabled Button
<template>
<div>
<BButton variant="primary" disabled>Disabled Primary</BButton>
<BButton disabled>Disabled Default</BButton>
</div>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Button Group
<template>
<BButtonGroup>
<BButton variant="primary">Left</BButton>
<BButton variant="primary">Middle</BButton>
<BButton variant="primary">Right</BButton>
</BButtonGroup>
</template>
<script setup>
import { BButton, BButtonGroup } from 'bootstrap-vue-next'
</script>Key Points
- Use
variantprop for button style (primary, success, danger, etc.) - Use
sizeprop for button size (sm, md, lg) - Use
disabledprop to disable button - Use
BIconfor icons - Use
BButtonGroupfor button groups - Button supports all standard HTML button attributes
Form | 表单
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use Form components in Bootstrap Vue 3.0.
Key Concepts
- Form component setup
- Form validation
- Form inputs
- Form submission
- Form layout
Example: Basic Form
<template>
<BForm @submit.prevent="onSubmit">
<BFormGroup label="Username" label-for="username">
<BFormInput
id="username"
v-model="form.username"
required
/>
</BFormGroup>
<BFormGroup label="Email" label-for="email">
<BFormInput
id="email"
v-model="form.email"
type="email"
required
/>
</BFormGroup>
<BButton type="submit" variant="primary">Submit</BButton>
</BForm>
</template>
<script setup>
import { ref } from 'vue'
import { BForm, BFormGroup, BFormInput, BButton } from 'bootstrap-vue-next'
const form = ref({
username: '',
email: ''
})
const onSubmit = () => {
console.log('Form submitted:', form.value)
}
</script>Example: Form with Validation
<template>
<BForm @submit.prevent="onSubmit">
<BFormGroup
label="Email"
label-for="email"
:invalid-feedback="emailFeedback"
:state="emailState"
>
<BFormInput
id="email"
v-model="form.email"
type="email"
:state="emailState"
required
/>
</BFormGroup>
<BFormGroup
label="Password"
label-for="password"
:invalid-feedback="passwordFeedback"
:state="passwordState"
>
<BFormInput
id="password"
v-model="form.password"
type="password"
:state="passwordState"
required
/>
</BFormGroup>
<BButton type="submit" variant="primary">Submit</BButton>
</BForm>
</template>
<script setup>
import { ref, computed } from 'vue'
import { BForm, BFormGroup, BFormInput, BButton } from 'bootstrap-vue-next'
const form = ref({
email: '',
password: ''
})
const emailState = computed(() => {
return form.value.email.length > 0 && form.value.email.includes('@')
})
const emailFeedback = computed(() => {
return emailState.value ? '' : 'Please enter a valid email'
})
const passwordState = computed(() => {
return form.value.password.length >= 6
})
const passwordFeedback = computed(() => {
return passwordState.value ? '' : 'Password must be at least 6 characters'
})
const onSubmit = () => {
if (emailState.value && passwordState.value) {
console.log('Form submitted:', form.value)
}
}
</script>Example: Form with Select
<template>
<BForm>
<BFormGroup label="Select" label-for="select">
<BFormSelect
id="select"
v-model="selected"
:options="options"
/>
</BFormGroup>
</BForm>
</template>
<script setup>
import { ref } from 'vue'
import { BForm, BFormGroup, BFormSelect } from 'bootstrap-vue-next'
const selected = ref(null)
const options = [
{ value: null, text: 'Please select' },
{ value: 'a', text: 'Option A' },
{ value: 'b', text: 'Option B' }
]
</script>Key Points
- Use
BFormcomponent to wrap form fields - Use
BFormGroupfor form field groups - Use
BFormInput,BFormSelect, etc. for inputs - Use
v-modelfor two-way binding - Use
:stateprop for validation state - Use
:invalid-feedbackfor error messages - Use
@submit.preventfor form submission
Grid | 栅格系统
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use the Grid system in Bootstrap Vue 3.0.
Key Concepts
- Container component
- Row component
- Col component
- Responsive breakpoints
- Grid alignment
Example: Basic Grid
<template>
<BContainer>
<BRow>
<BCol>Column 1</BCol>
<BCol>Column 2</BCol>
<BCol>Column 3</BCol>
</BRow>
</BContainer>
</template>
<script setup>
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>Example: Responsive Grid
<template>
<BContainer>
<BRow>
<BCol cols="12" md="6" lg="4">Column 1</BCol>
<BCol cols="12" md="6" lg="4">Column 2</BCol>
<BCol cols="12" md="6" lg="4">Column 3</BCol>
</BRow>
</BContainer>
</template>
<script setup>
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>Example: Grid with Offsets
<template>
<BContainer>
<BRow>
<BCol cols="4" offset="4">Centered Column</BCol>
</BRow>
</BContainer>
</template>
<script setup>
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>Example: Grid Alignment
<template>
<BContainer>
<BRow align-v="center" align-h="center">
<BCol cols="6">Centered Content</BCol>
</BRow>
</BContainer>
</template>
<script setup>
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>Key Points
- Use
BContainerfor container - Use
BRowfor rows - Use
BColfor columns - Use
colsprop for column width - Use responsive props (sm, md, lg, xl, xxl)
- Use
offsetprop for column offset - Use
align-vandalign-hfor alignment
Modal | 模态框
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use the Modal component in Bootstrap Vue 3.0.
Key Concepts
- Basic Modal
- Modal with form
- Modal with programmatic control
- Modal sizes
- Modal events
Example: Basic Modal
<template>
<div>
<BButton @click="showModal = true">Open Modal</BButton>
<BModal v-model="showModal" title="Modal Title">
<p>Modal content goes here</p>
</BModal>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BButton, BModal } from 'bootstrap-vue-next'
const showModal = ref(false)
</script>Example: Modal with Form
<template>
<div>
<BButton @click="showModal = true">Open Modal</BButton>
<BModal
v-model="showModal"
title="Form Modal"
@ok="handleOk"
>
<BForm>
<BFormGroup label="Name" label-for="name">
<BFormInput id="name" v-model="form.name" />
</BFormGroup>
</BForm>
</BModal>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BButton, BModal, BForm, BFormGroup, BFormInput } from 'bootstrap-vue-next'
const showModal = ref(false)
const form = ref({ name: '' })
const handleOk = () => {
console.log('Form submitted:', form.value)
showModal.value = false
}
</script>Example: Modal with Programmatic Control
<template>
<div>
<BButton @click="openModal">Open Modal</BButton>
<BModal
ref="modal"
title="Programmatic Modal"
>
<p>Modal content</p>
</BModal>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BButton, BModal } from 'bootstrap-vue-next'
const modal = ref(null)
const openModal = () => {
modal.value.show()
}
</script>Example: Modal Sizes
<template>
<div>
<BButton @click="showSmall = true">Small Modal</BButton>
<BButton @click="showLarge = true">Large Modal</BButton>
<BModal v-model="showSmall" title="Small Modal" size="sm">
<p>Small modal content</p>
</BModal>
<BModal v-model="showLarge" title="Large Modal" size="lg">
<p>Large modal content</p>
</BModal>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BButton, BModal } from 'bootstrap-vue-next'
const showSmall = ref(false)
const showLarge = ref(false)
</script>Key Points
- Use
BModalcomponent withv-modelfor visibility - Use
titleprop for modal title - Use
@okevent for OK button handler - Use
sizeprop for modal size (sm, lg, xl) - Use
refandshow()method for programmatic control - Modal supports slots for header, footer, etc.
Table | 表格
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use the Table component in Bootstrap Vue 3.0.
Key Concepts
- Basic Table
- Table with data
- Table with sorting
- Table with filtering
- Table with pagination
- Table with selection
Example: Basic Table
<template>
<BTable :items="items" :fields="fields" />
</template>
<script setup>
import { ref } from 'vue'
import { BTable } from 'bootstrap-vue-next'
const fields = [
{ key: 'name', label: 'Name' },
{ key: 'age', label: 'Age' },
{ key: 'address', label: 'Address' }
]
const items = ref([
{ name: 'John Brown', age: 32, address: 'New York' },
{ name: 'Jim Green', age: 42, address: 'London' },
{ name: 'Joe Black', age: 32, address: 'Sidney' }
])
</script>Example: Table with Sorting
<template>
<BTable
:items="items"
:fields="fields"
sortable
/>
</template>
<script setup>
import { ref } from 'vue'
import { BTable } from 'bootstrap-vue-next'
const fields = [
{ key: 'name', label: 'Name', sortable: true },
{ key: 'age', label: 'Age', sortable: true },
{ key: 'address', label: 'Address' }
]
const items = ref([
{ name: 'John Brown', age: 32, address: 'New York' },
{ name: 'Jim Green', age: 42, address: 'London' },
{ name: 'Joe Black', age: 32, address: 'Sidney' }
])
</script>Example: Table with Pagination
<template>
<div>
<BTable
:items="items"
:fields="fields"
:per-page="perPage"
:current-page="currentPage"
/>
<BPagination
v-model="currentPage"
:total-rows="items.length"
:per-page="perPage"
/>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BTable, BPagination } from 'bootstrap-vue-next'
const fields = [
{ key: 'name', label: 'Name' },
{ key: 'age', label: 'Age' },
{ key: 'address', label: 'Address' }
]
const items = ref([
{ name: 'John Brown', age: 32, address: 'New York' },
{ name: 'Jim Green', age: 42, address: 'London' },
{ name: 'Joe Black', age: 32, address: 'Sidney' }
])
const perPage = ref(10)
const currentPage = ref(1)
</script>Example: Table with Selection
<template>
<BTable
:items="items"
:fields="fields"
selectable
select-mode="multi"
v-model:selected="selected"
/>
</template>
<script setup>
import { ref } from 'vue'
import { BTable } from 'bootstrap-vue-next'
const fields = [
{ key: 'name', label: 'Name' },
{ key: 'age', label: 'Age' },
{ key: 'address', label: 'Address' }
]
const items = ref([
{ name: 'John Brown', age: 32, address: 'New York' },
{ name: 'Jim Green', age: 42, address: 'London' },
{ name: 'Joe Black', age: 32, address: 'Sidney' }
])
const selected = ref([])
</script>Key Points
- Use
BTablecomponent with:itemsand:fieldsprops - Use
:fieldsto define table columns - Use
:itemsfor table data - Use
sortableprop for sorting - Use
BPaginationfor pagination - Use
selectableandselect-modefor row selection - Use
v-model:selectedfor selected rows
Tooltip Directive | 工具提示指令
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to use the v-b-tooltip directive in Bootstrap Vue 3.0.
Key Concepts
- Basic tooltip
- Tooltip placement
- Tooltip triggers
- Tooltip with HTML content
Example: Basic Tooltip
<template>
<BButton v-b-tooltip="'This is a tooltip'">
Hover me
</BButton>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Tooltip Placement
<template>
<div>
<BButton v-b-tooltip.top="'Top tooltip'">Top</BButton>
<BButton v-b-tooltip.bottom="'Bottom tooltip'">Bottom</BButton>
<BButton v-b-tooltip.left="'Left tooltip'">Left</BButton>
<BButton v-b-tooltip.right="'Right tooltip'">Right</BButton>
</div>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Tooltip with Options
<template>
<BButton
v-b-tooltip="{
title: 'Tooltip content',
placement: 'top',
trigger: 'hover'
}"
>
Hover me
</BButton>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Key Points
- Use
v-b-tooltipdirective for tooltips - Use placement modifiers (.top, .bottom, .left, .right)
- Use object syntax for more options
- Tooltip appears on hover by default
- Supports HTML content with html option
Basic Usage | 基本用法
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates basic Bootstrap Vue component usage in Vue 3.
Key Concepts
- Using components
- Component props
- Component events
- Composition API
Example: Button Component
<template>
<div>
<BButton variant="primary">Primary</BButton>
<BButton variant="success">Success</BButton>
<BButton variant="danger">Danger</BButton>
</div>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
</script>Example: Button with Events
<template>
<BButton variant="primary" @click="handleClick">
Click Me
</BButton>
</template>
<script setup>
import { BButton } from 'bootstrap-vue-next'
const handleClick = () => {
console.log('Button clicked!')
}
</script>Example: Form Input
<template>
<BFormInput
v-model="value"
placeholder="Enter text"
/>
</template>
<script setup>
import { ref } from 'vue'
import { BFormInput } from 'bootstrap-vue-next'
const value = ref('')
</script>Example: Multiple Components
<template>
<BCard title="Example Card">
<BFormInput v-model="value" placeholder="Enter text" />
<BButton variant="primary" class="mt-3">Submit</BButton>
</BCard>
</template>
<script setup>
import { ref } from 'vue'
import { BCard, BFormInput, BButton } from 'bootstrap-vue-next'
const value = ref('')
</script>Key Points
- Import components from 'bootstrap-vue-next'
- Use component props to configure behavior
- Use v-model for two-way binding
- Use @click for event handling
- Use Composition API with script setup
- Components follow Bootstrap 5 styling
Installation | 安装
官方文档: https://bootstrap-vue.org
Instructions
This example demonstrates how to install Bootstrap Vue 3.0 and set it up in a Vue 3 project.
Key Concepts
- Installing Bootstrap Vue
- Importing Bootstrap CSS
- Registering components
- Basic setup
Example: Installation
# Using npm
npm install bootstrap-vue-next bootstrap
# Using yarn
yarn add bootstrap-vue-next bootstrap
# Using pnpm
pnpm add bootstrap-vue-next bootstrapExample: Import Bootstrap CSS
// In main.js or main.ts
import 'bootstrap/dist/css/bootstrap.css'Example: Basic Setup
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import BootstrapVue3 from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.use(BootstrapVue3)
app.mount('#app')Example: Tree-shaking Setup
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import { BButton, BFormInput } from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.component('BButton', BButton)
app.component('BFormInput', BFormInput)
app.mount('#app')Example: TypeScript Setup
// main.ts
import { createApp } from 'vue'
import App from './App.vue'
import BootstrapVue3 from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.use(BootstrapVue3)
app.mount('#app')Key Points
- Install bootstrap-vue-next and bootstrap packages
- Import Bootstrap CSS in entry file
- Use app.use(BootstrapVue3) for global registration
- Or register components individually for tree-shaking
- Works with both JavaScript and TypeScript
- Requires Vue 3 and Bootstrap 5
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Component Template | 组件模板
Basic Component Usage
<template>
<BComponentName
prop1="value1"
prop2="value2"
@event="handleEvent"
/>
</template>
<script setup>
import { BComponentName } from 'bootstrap-vue-next'
const handleEvent = () => {
console.log('Event handled')
}
</script>Component with v-model
<template>
<BFormInput
v-model="value"
placeholder="Enter text"
/>
</template>
<script setup>
import { ref } from 'vue'
import { BFormInput } from 'bootstrap-vue-next'
const value = ref('')
</script>Component in Form
<template>
<BForm @submit.prevent="onSubmit">
<BFormGroup label="Field" label-for="field">
<BFormInput
id="field"
v-model="form.field"
required
/>
</BFormGroup>
<BButton type="submit" variant="primary">Submit</BButton>
</BForm>
</template>
<script setup>
import { ref } from 'vue'
import { BForm, BFormGroup, BFormInput, BButton } from 'bootstrap-vue-next'
const form = ref({
field: ''
})
const onSubmit = () => {
console.log('Form submitted:', form.value)
}
</script>Project Setup Template | 项目设置模板
Basic Vue 3 + Bootstrap Vue Setup
// package.json
{
"dependencies": {
"vue": "^3.0.0",
"bootstrap-vue-next": "^0.0.0",
"bootstrap": "^5.0.0"
}
}// main.js
import { createApp } from 'vue'
import App from './App.vue'
import BootstrapVue3 from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.use(BootstrapVue3)
app.mount('#app')<!-- App.vue -->
<template>
<BContainer>
<BRow>
<BCol>
<h1>Bootstrap Vue App</h1>
</BCol>
</BRow>
</BContainer>
</template>
<script setup>
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>With TypeScript
// main.ts
import { createApp } from 'vue'
import App from './App.vue'
import BootstrapVue3 from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.use(BootstrapVue3)
app.mount('#app')<!-- App.vue -->
<template>
<BContainer>
<BRow>
<BCol>
<h1>Bootstrap Vue App</h1>
</BCol>
</BRow>
</BContainer>
</template>
<script setup lang="ts">
import { BContainer, BRow, BCol } from 'bootstrap-vue-next'
</script>With Tree-shaking
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import { BButton, BFormInput, BContainer, BRow, BCol } from 'bootstrap-vue-next'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css'
const app = createApp(App)
app.component('BButton', BButton)
app.component('BFormInput', BFormInput)
app.component('BContainer', BContainer)
app.component('BRow', BRow)
app.component('BCol', BCol)
app.mount('#app')