@bootcn-vue/cli
v0.8.0
Published
CLI for adding accessible, customizable Bootstrap + Vue 3 components to your project
Maintainers
Readme
@bootcn-vue/cli
CLI for adding Bootstrap + Vue 3 components to your project.
Installation
# Using npm
npm install -g @bootcn-vue/cli
# Using pnpm
pnpm add -g @bootcn-vue/cli
# Using npx (no installation required)
npx @bootcn-vue/cliUsage
Initialize bootcn-vue in your project
npx bootcn-vue initThis command will:
- Detect your Vue 3 + Vite project
- Ask for your
srcdirectory location - Create
bootcn.config.jsonconfiguration file - Update
tsconfig.jsonwith path aliases (@/*) - Update
vite.config.tswith path aliases - Create
src/lib/utils.tswith thecn()utility function - Create
src/components/ui/directory for components - Install required dependencies (bootstrap, reka-ui, cva, clsx, tailwind-merge)
Add components to your project
# Add a single component
npx bootcn-vue add button
# Add multiple components
npx bootcn-vue add button input
# Interactive mode - select from list
npx bootcn-vue addThis command will:
- Copy component files from
@bootcn-vue/buttonstosrc/components/ui/Button/ - Transform imports from package imports to local imports
- Make the component ready to use
Remove components from your project
# Remove a single component
npx bootcn-vue remove button
# Remove multiple components
npx bootcn-vue remove button input
# Interactive mode - select from list
npx bootcn-vue remove
# Remove ALL bootcn-vue setup (components, config, utils)
npx bootcn-vue remove --allThe remove --all command will:
- Delete all components in
src/components/ui/ - Delete
src/lib/utils.ts(andlib/directory if empty) - Delete
bootcn.config.json - Show command to uninstall dependencies
- Include safety confirmations before removing
Configuration
After running init, a bootcn.config.json file is created:
{
"$schema": "https://bootcn-vue.dev/schema.json",
"srcDir": "src",
"aliases": {
"components": "@/components",
"utils": "@/lib"
}
}Usage in your Vue app
After adding components:
<script setup lang="ts">
import { Button } from "@/components/ui/Button";
</script>
<template>
<Button variant="primary" size="lg"> Click me </Button>
</template>Requirements
- Vue 3
- Vite
- Node.js >= 20.0.0
Available Components
UI Components
| Component | Key | Description |
| ------------- | ---------------- | ------------------------------------------------------------------ |
| Button | button | Button component with Bootstrap variants and sizes |
| Tooltip | tooltip | Accessible tooltips with Tooltip, TooltipTrigger, TooltipContent |
| Checkbox | checkbox | Tri-state checkbox with Checkbox, CheckboxGroup, CheckboxGroupItem |
| Radio | radio | Radio buttons with RadioGroup, RadioGroupItem, RadioYesNo |
| FieldText | field-text | Complete text input field with validation |
| FieldPassword | field-password | Password field with show/hide toggle |
| FieldSSN | field-ssn | Social Security Number field with masking |
Form Primitives
| Component | Key | Description |
| ----------------- | --------------------- | ------------------------------- |
| InputRoot | input-root | Form input container primitive |
| InputLabel | input-label | Form label with tooltip support |
| InputField | input-field | Basic input field primitive |
| InputPassword | input-password | Password input primitive |
| InputError | input-error | Error message display |
| InputHelp | input-help | Help text display |
| InputMasked | input-masked | Input with masking support |
| InputNumericRange | input-numeric-range | Numeric range input |
Usage Examples
# Add UI components
npx bootcn-vue add button
npx bootcn-vue add checkbox radio
npx bootcn-vue add tooltip field-text field-password
# Add form primitives
npx bootcn-vue add input-root input-label input-field
npx bootcn-vue add input-error input-help
# Interactive selection
npx bootcn-vue addIn your Vue components:
<script setup lang="ts">
import { Button } from "@/components/ui/Button";
import { Checkbox, CheckboxGroup } from "@/components/ui/Checkbox";
import { RadioGroup, RadioYesNo } from "@/components/ui/Radio";
import {
Tooltip,
TooltipTrigger,
TooltipContent,
} from "@/components/ui/Tooltip";
</script>
<template>
<div>
<Button variant="primary">Submit</Button>
<Checkbox v-model="accepted" label="I accept the terms" />
<CheckboxGroup
v-model="selectedOptions"
:options="[
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
]"
/>
<RadioGroup
v-model="selectedValue"
:options="[
{ label: 'Choice A', value: 'a' },
{ label: 'Choice B', value: 'b' },
]"
/>
<RadioYesNo v-model="yesNoValue" />
<Tooltip>
<TooltipTrigger>
<Button variant="outline-secondary">Help</Button>
</TooltipTrigger>
<TooltipContent>This is helpful information</TooltipContent>
</Tooltip>
</div>
</template>License
MIT
