Icon
The Icon component helps to display icons the right way. Icons are an important part of any application. Oruga is compatible with both Material Design Icons and FontAwesome 5 but you can also add your own custom icon pack.
Examples
Base
Custom icon pack
You can also add it during Oruga import as default config.
TIP
Take a look at below example code (click on "Show code") to know all internal icons to replace with the releated icons of your custom icon pack
Override icon pack
You can also customize some properties of the default icon packs. In this example, default sizes for FontAwesome have been modified.
const customIconConfig = {
customIconPacks: {
fas: {
sizes: {
default: null,
small: null,
medium: "fa-lg",
large: "fa-xl"
}
}
}
}
import Oruga from "@oruga-ui/oruga";
app.use(Oruga, {
iconComponent: "vue-fontawesome",
iconPack: "fas",
...customIconConfig
}); ```
Custom icon component
TIP
You can set the `iconComponent` config option to render icons with the vue-fontawesome component (it should work with other Vue icon components as well).
import { library } from "@fortawesome/fontawesome-svg-core";
// internal icons
import {
faCheck,
faCheckCircle,
faInfoCircle,
faExclamationTriangle,
faExclamationCircle,
faArrowUp,
faAngleRight,
faAngleLeft,
faAngleDown,
faEye,
faEyeSlash,
faCaretDown,
faCaretUp
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(
faCheck,
faCheckCircle,
faInfoCircle,
faExclamationTriangle,
faExclamationCircle,
faArrowUp,
faAngleRight,
faAngleLeft,
faAngleDown,
faEye,
faEyeSlash,
faCaretDown,
faCaretUp
);
app.component("vue-fontawesome", FontAwesomeIcon);
// ...
import Oruga from "@oruga-ui/oruga";
app.use(Oruga, {
iconComponent: "vue-fontawesome",
iconPack: "fas"
}); ```
Icon component
Icons take an important role of any application.
<o-icon></o-icon>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
clickable | When true makes icon clickable | boolean | - | false |
component | Icon component name | DynamicComponent | - | From config: { |
customSize | Overrides icon font size | string | Depends on library: null (smallest) , fa-sm , fa-lg , fa-xl , mdi-18px , mdi-24px , mdi-36px , mdi-48px | |
icon | Icon name | string | - | |
override | Override existing theme classes completely | boolean | - | |
pack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: { |
rotation | Rotation 0-360 | number | string | - | |
size | Icon size | string | small , medium , large | From config: icon: { |
spin | Enable spin effect on icon | boolean | - | false |
variant | Color of the icon | string | primary , info , success , warning , danger , and any other custom color | From config: icon: { |
Class Inspector
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
rootClass | Class of the root element. | |||
sizeClass | Class of the root element with size. | size | small | |
variantClass | Class of the root element with variant. | variant | primary | |
clickableClass | Class of the root element when clickable. | clickable | ||
spinClass | Class of the root element when spin. | spin |
Sass variables
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$icon-spin-animation-duration | 1.5s |
See ➜ 📄 Full scss file