Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pierreavn/angular-tabler-icons
Tabler Icons components library for your Angular applications
https://github.com/pierreavn/angular-tabler-icons
angular components icons library svg tabler
Last synced: 3 months ago
JSON representation
Tabler Icons components library for your Angular applications
- Host: GitHub
- URL: https://github.com/pierreavn/angular-tabler-icons
- Owner: pierreavn
- License: mit
- Created: 2021-05-21T10:40:55.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-25T21:41:25.000Z (8 months ago)
- Last Synced: 2024-04-26T17:08:50.337Z (7 months ago)
- Topics: angular, components, icons, library, svg, tabler
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/angular-tabler-icons
- Size: 3.88 MB
- Stars: 20
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-angular - angular-tabler-icons - This package allows you to use the [Tabler Icons](https://tabler.io/icons) in your Angular applications. (Table of contents / Third Party Components)
- fucking-awesome-angular - angular-tabler-icons - This package allows you to use the 🌎 [Tabler Icons](tabler.io/icons) in your Angular applications. (Table of contents / Third Party Components)
- fucking-awesome-angular - angular-tabler-icons - This package allows you to use the 🌎 [Tabler Icons](tabler.io/icons) in your Angular applications. (Table of contents / Third Party Components)
README
# angular-tabler-icons
[![tabler-icons-version](https://img.shields.io/badge/Tabler%20Icons-v3.1.0-%23206bc4?style=flat-square)](https://tabler.io/icons)
[![license](https://img.shields.io/npm/l/angular-tabler-icons.svg?style=flat-square)]()
[![downloads](https://img.shields.io/npm/dm/angular-tabler-icons?style=flat-square)]()## Description
This package allows you to use the [Tabler Icons](https://tabler.io/icons) in your angular applications. Tabler Icons is a set of free MIT-licensed high-quality SVG icons for you to use in your web projects. Each icon is designed on a 24x24 grid and a 2px stroke.
Inspired by [angular-feather](https://github.com/michaelbazos/angular-feather), thank you to the author.## Usage
_1. Install the package_
```sh
npm install angular-tabler-icons
# or
yarn add angular-tabler-icons
```_2. Generate a module to host the icons you'll import_
```sh
ng generate module icons
```
_3. Import assets_You need to import:
- TablerIconsModule, as it contains the `` component
- The icons that you needWe put this in IconsModule for modularity. See example below:
*file: icon.module.ts*
```ts
import { NgModule } from '@angular/core';import { TablerIconsModule } from 'angular-tabler-icons';
import { IconCamera, IconHeart, IconBrandGithub } from 'angular-tabler-icons/icons';// Select some icons (use an object, not an array)
const icons = {
IconCamera,
IconHeart,
IconBrandGithub
};@NgModule({
imports: [
TablerIconsModule.pick(icons)
],
exports: [
TablerIconsModule
]
})
export class IconsModule { }// NOTES:
// 1. We add TablerIconsModule to the 'exports', since the component will be used in templates of parent module
// 2. Don't forget to pick some icons using TablerIconsModule.pick({ ... })
```_4. Import IconsModule_
If you are using NgModules, import it this way:
```ts
import { NgModule } from "@angular/core";
import { MyComponent } from './my/my.component';
import { IconsModule } from "./icons.module";@NgModule({
declarations: [MyComponent],
imports: [
IconsModule, // <--- Here
],
})
export class MyModule {}
```If you are using Standalone Components, import it this way:
```ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { IconsModule } from './icons.module';@Component({
selector: 'app-my',
standalone: true,
imports: [CommonModule, RouterOutlet, IconsModule], // <--- Here
templateUrl: './my.component.html',
styleUrls: ['./my.component.scss']
})
export class MyComponent {}
```_5. Use it in template_
After importing the _IconsModule_ in your feature or shared module, use the icons as follows:
```html
```
## Available icons
List of available icons: https://tabler.io/icons
This version includes **Tabler Icons v3.1.0**, see [changelog](https://tabler.io/icons/changelog) to know which icons are available.## Styling icons
Each icon can be styled separately with CSS:
```html
```
```css
.big {
height: 50px;
width: 50px;
}.fill-red {
fill: red;
}.stroke-blue {
color: blue;
}.thin {
stroke-width: 1px;
}
```## Options
Some options are available to configure the module:
```ts
import { environment } from '../environments/environment';
import { TablerIconsModule } from 'angular-tabler-icons';
import * as TablerIcons from 'angular-tabler-icons/icons';@NgModule({
imports: [
TablerIconsModule.pick(TablerIcons, {// Ignore warnings, such as "Tabler Icon not found", for example:
// ignoreWarnings: environment.production,
ignoreWarnings: true,})
],
exports: [
TablerIconsModule
]
})
export class IconsModule { }
```## Pick all icons
You can import all icons at once by doing the following. However, keep in mind that by doing this, all icons will end up in your application bundle. While this may not be much of an issue for prototyping, **it is not recommended for any application that you plan to release**.
```ts
import { TablerIconsModule } from 'angular-tabler-icons';
import * as TablerIcons from 'angular-tabler-icons/icons';@NgModule({
imports: [
TablerIconsModule.pick(TablerIcons)
],
exports: [
TablerIconsModule
]
})
export class IconsModule { }
```## Angular version compatibility
| Angular | angular-tabler-icons |
|---------|----------------------|
| 17 | 2.40.1+ |
| 16 | 2.21.1+ |
| 15 | 1.117.1+ |
| 14 | 1.72.1+ |
| 13 | 1.53.1+ |
| 12 | 1.41.3+ |
| 11 | 1.41.0+ |## Contributing
Feel free to report issues or to contibute to this project!
Here are few tips to start:
```bash
$ yarn lib:generate # generate components from Tabler Icons
$ yarn lib:build # build angular library
```## How to rebuild for newer tabler icons version
1. Run GitHub actions workflow `Automatic PR on Tabler Icons Release`, with new Tabler Icons version (e.g. `2.40.0`). This workflow will create automatically a new Pull Request.
2. Approve and Merge the generated Pull Request.
3. Create a release/tag with the new Tabler Icons version.
Package is automatically rebuilt and published, with the GitHub actions workflow `Build and Publish package`.