ngx bootstrap icons
v.1.9.2
npm i ngx-bootstrap-icons --save
Demonstração aqui
npm i ngx-bootstrap-icons --save import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' ; Você pode importar todos os ícones (não recomendados) ou cada ícone individualmente.
import { allIcons } from 'ngx-bootstrap-icons' ; import { alarm , alarmFill , alignBottom } from 'ngx-bootstrap-icons' ;
// Select some icons (use an object, not an array)
const icons = {
alarm ,
alarmFill ,
alignBottom
} ; import { NgxBootstrapIconsModule , allIcons } from 'ngx-bootstrap-icons' ;
@ NgModule ( {
declarations : [
AppComponent
] ,
imports : [
BrowserModule ,
AppRoutingModule ,
NgxBootstrapIconsModule . pick ( allIcons )
] ,
providers : [ ] ,
bootstrap : [ AppComponent ]
} )
export class AppModule { } import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' ;
import { alarm , alarmFill , alignBottom } from 'ngx-bootstrap-icons' ;
// Select some icons (use an object, not an array)
const icons = {
alarm ,
alarmFill ,
alignBottom
} ;
@ NgModule ( {
declarations : [
AppComponent
] ,
imports : [
BrowserModule ,
AppRoutingModule ,
NgxBootstrapIconsModule . pick ( icons )
] ,
providers : [ ] ,
bootstrap : [ AppComponent ]
} )
export class AppModule { }
/**
Another way.
--------------
Import NgxBootstrapIconsModule.pick(icons) inside of the AppModule
Import NgxBootstrapIconsModule (without the pick() method) inside of any FeatureModule where will be used.
Now you can import icons in one place only (root module) and successfully use the component anywhere you want.
**/ import { NgxBootstrapIconsModule , ColorTheme } from 'ngx-bootstrap-icons' ;
import { alarm , alarmFill , alignBottom } from 'ngx-bootstrap-icons' ;
// Select some icons (use an object, not an array)
const icons = {
alarm ,
alarmFill ,
alignBottom
} ;
@ NgModule ( {
declarations : [
AppComponent
] ,
imports : [
BrowserModule ,
AppRoutingModule ,
NgxBootstrapIconsModule . pick ( icons , {
width : '2em' ,
height : '2em' ,
theme : ColorTheme . Danger ,
} )
] ,
providers : [ ] ,
bootstrap : [ AppComponent ]
} )
export class AppModule { } | Nome da entrada Prarameter | Tipo | Obrigatório | Valor padrão | Descrição |
|---|---|---|---|---|
| largura | string | false | null | Ícone Largura padrão |
| altura | string | false | null | Altura padrão do ícone |
| tema | enum | false | null | Tema de cor padrão |
< i - bs name = "alarm-fill" > < / i - bs >ou (com sua tag preferida)
< i i - bs name = "alarm-fill" > < / i >ou opcionalmente, use nossas enumes para obter suporte de preenchimento automático
import { iconNamesEnum } from 'ngx-bootstrap-icons' ;
public iconNames = iconNamesEnum ;
< i - bs [ name ] = "iconNames.AlarmFill" > < / i - bs >Além disso, você pode usar a largura e a altura para o ícone (por largura e altura padrão são 1Rem)
< i - bs
name = "alarm-fill"
width = "2rem"
height = "2rem" >
< / i - bs > <i
i-bs
name="alarm-fill"
width="2rem"
height="2rem">
</i>
| Nome da entrada Prarameter | Tipo | Obrigatório | Valor padrão | Descrição |
|---|---|---|---|---|
| nome | string | true | null | nome do ícone |
| largura | string | false | null | largura do ícone. Valor padrão usado de SVG |
| altura | string | false | null | altura do ícone. Valor padrão usado de SVG |
| ResetDefaultDimensions | boolean | false | false | Se este parâmetro estiver definido, as dimensões padrão do ícone SVG serão removidas |