Skip to content

Commit e26c22a

Browse files
committed
Reorganise README and add section about BootstrapVue
1 parent c829851 commit e26c22a

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed

README.md

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,30 @@
1515

1616
> Bootstrap Icons are designed to work with Bootstrap components, from form controls to navigation. But, they'll work in just about any project, too. That's because Bootstrap Icons are SVGs, so they scale quickly and easily and can be styled with CSS. -- [Bootstrap Icons]
1717
18-
This package provides bootstrap icons as Vue components.
18+
This library provides Bootstrap icons as Vue 3.x components.
1919

20-
Built from Bootstrap Icons v1.5.0. **Requires Vue 3.**
20+
Built from Bootstrap Icons v1.5.0.
2121

22-
## Usage
23-
24-
All icons are exported following the `PascalCase` naming convention, prefixed with `BIcon`. For example, the icon `battery-full` is exported as `BIconBatteryFull`, the icon `arrow-90deg-down` is exported as `BIconArrow90degDown`, etc. Vue allows you to refer to them in templates using either `PascalCase` or `kebab-case`.
25-
26-
```vue
27-
<template>
28-
<BIconArrow90degDown />
29-
<!-- Or -->
30-
<b-icon-arrow-90deg-down />
31-
</template>
32-
```
33-
34-
Each icon is `1em` in width and height. They can be styled by inheriting from their parent element, or receiving class or style attribute directly.
35-
36-
You can find the full list of available icons at https://icons.getbootstrap.com/.
37-
38-
### With module bundlers
39-
40-
First install the package using your package manager of choice:
22+
## Installation
4123

4224
```sh
25+
# Using yarn
4326
yarn add bootstrap-icons-vue
4427

45-
# or
46-
28+
# Or npm
4729
npm install bootstrap-icons-vue
4830
```
4931

50-
Then import the icons using one of the methods below:
32+
Alternatively, you can use them straight from a CDN without installation.
33+
34+
```html
35+
<script src="https://unpkg.com/vue@3.0.11"></script>
36+
<script src="https://unpkg.com/bootstrap-icons-vue@0.7.0"></script>
37+
```
38+
39+
## Usage
5140

52-
**1. Importing specific icons**
41+
**1. Importing individual icons**
5342

5443
Making them globally available for an app:
5544

@@ -64,7 +53,7 @@ app.component('BIconBookmark', BIconBookmark);
6453
app.mount('#app');
6554
```
6655

67-
Or for just one component:
56+
Or just for one component:
6857

6958
```js
7059
import { BIconBatteryFull, BIconArrow90degDown, BIconBookmark } from 'bootstrap-icons-vue';
@@ -90,29 +79,45 @@ app.use(BootstrapIconsPlugin);
9079
app.mount('#app');
9180
```
9281

93-
Note that this registers all icon components to the app instance, unused icons will not be tree-shakable.
82+
Note that this will register all icon components to the app instance, unused icons will not be tree-shakable.
9483

95-
### Browser
84+
**3. Import all icons (for CDN build)**
9685

97-
Include the scripts from CDN as follows:
98-
99-
```html
100-
<script src="https://unpkg.com/vue@3.0.6"></script>
101-
<script src="https://unpkg.com/bootstrap-icons-vue@0.7.0"></script>
102-
```
103-
104-
Vue 3 does not have a global application instance, so it is not possible to install the icons components automatically. Instead the browser build exports a plugin `BootstrapIconsVue` to be installed:
86+
Vue 3 does not have a global application instance, so it is not possible to automatically expose the icons components. Instead you should install the provided plugin to your app instance.
10587

10688
```js
10789
const app = Vue.createApp(/** App **/);
10890
app.use(BootstrapIconsVue);
10991
app.mount('#app');
11092
```
11193

94+
### Naming convention
95+
96+
All icons are exported following the `PascalCase` naming convention, prefixed with `BIcon`. For example, the icon `battery-full` is exported as `BIconBatteryFull`, the icon `arrow-90deg-down` is exported as `BIconArrow90degDown`, etc. Vue allows you to refer to them in templates using either `PascalCase` or `kebab-case`.
97+
98+
```html
99+
<template>
100+
<BIconArrow90degDown />
101+
<!-- Or -->
102+
<b-icon-arrow-90deg-down />
103+
</template>
104+
```
105+
106+
Each icon is `1em` in width and height. They can be styled by inheriting from their parent element, or receiving class or style attribute directly.
107+
108+
You can find the full list of available icons at https://icons.getbootstrap.com/.
109+
110+
## Relation to [BootstrapVue]
111+
112+
BootstrapVue implements Bootstrap components (including Bootstrap Icons) and grid system as Vue 2 components. bootstrap-icons-vue is **NOT** intended to be used alongside BootstrapVue, as the latter is a superset of this project. Besides, they target different major Vue version.
113+
114+
This library is for those who wants to use Bootstrap Icons but do not wish to pull in a massive dependency (BootstrapVue).
115+
112116
## Development
113117

114118
Install dependencies with `yarn install` then generate icon files with `yarn build`. To test the browser build, run `yarn dev:cdn`. With the vite app, first link the library by running `yarn link` in this directory, then `yarn link bootstrap-icons-vue` in `./dev-vite`, finally run `yarn dev:vite` back in this directory.
115119

116120
The `upgrade.sh` script upgrades everything and update the docs with new version specifiers.
117121

118122
[Bootstrap Icons]: https://icons.getbootstrap.com/
123+
[BootstrapVue]: https://github.com/bootstrap-vue/bootstrap-vue

0 commit comments

Comments
 (0)