Using Bootstrap Icons
Register a custom pack to use Bootstrap Icons, or any other @ng-icons set, alongside the built-in Lucide pack.
Install the Bootstrap icon set
pnpm
bash
pnpm add @ng-icons/bootstrap-iconsnpm
bash
npm install @ng-icons/bootstrap-iconsyarn
bash
yarn add @ng-icons/bootstrap-icons Register the pack with createTngIconPack
icons.provider.ts
typescript
// icons.provider.ts
import { createTngIconPack, provideTngIcons, type TngIconLoader } from '@tailng-ui/icons';
function createBootstrapLoader(exportName: string): TngIconLoader {
return async () => {
const mod = await import('@ng-icons/bootstrap-icons') as Record<string, unknown>;
const svg = mod[exportName];
if (typeof svg !== 'string') {
throw new Error(`Bootstrap icon "${exportName}" not found.`);
}
return svg;
};
}
const bootstrapPack = createTngIconPack('bootstrap', {
'star-fill': createBootstrapLoader('bootstrapStarFill'),
'bell': createBootstrapLoader('bootstrapBell'),
'x-circle': createBootstrapLoader('bootstrapXCircle'),
});
export const tngIconProviders = provideTngIcons({
packs: [bootstrapPack],
});Use in templates
my.component.html
html
<!-- explicit pack prefix -->
<tng-icon icon="bootstrap:star-fill" size="1.25rem" />
<tng-icon icon="bootstrap:bell" size="1.25rem" />
<!-- when bootstrap is set as defaultPack, prefix is optional -->
<tng-icon icon="star-fill" size="1.25rem" />