@@ -11,7 +11,8 @@ import { BaseComponent } from 'flowbite-angular';
1111import { IconComponent , IconRegistry } from 'flowbite-angular/icon' ;
1212import { CHEVRON_UP_SVG_ICON } from 'flowbite-angular/utils' ;
1313
14- import type { OnInit } from '@angular/core' ;
14+ import { NgTemplateOutlet } from '@angular/common' ;
15+ import type { OnInit , TemplateRef } from '@angular/core' ;
1516import {
1617 ChangeDetectionStrategy ,
1718 Component ,
@@ -31,6 +32,10 @@ export const FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE = new InjectionToken<
3132 keyof ScrollTopPositions
3233> ( 'FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE' ) ;
3334
35+ export const FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE = new InjectionToken <
36+ TemplateRef < unknown > | undefined
37+ > ( 'FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE' ) ;
38+
3439export const FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken <
3540 DeepPartial < ScrollTopTheme >
3641> ( 'FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE' ) ;
@@ -44,6 +49,10 @@ export const scrollTopDefaultValueProvider = makeEnvironmentProviders([
4449 provide : FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE ,
4550 useValue : 'bottom-right' ,
4651 } ,
52+ {
53+ provide : FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE ,
54+ useValue : undefined ,
55+ } ,
4756 {
4857 provide : FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE ,
4958 useValue : { } ,
@@ -56,10 +65,16 @@ export const scrollTopDefaultValueProvider = makeEnvironmentProviders([
5665@Component ( {
5766 selector : 'flowbite-scroll-top' ,
5867 standalone : true ,
59- imports : [ IconComponent ] ,
60- template : `<flowbite-icon
61- svgIcon="flowbite-angular:chevron-up"
62- class="w-5 h-5" />` ,
68+ imports : [ IconComponent , NgTemplateOutlet ] ,
69+ template : `
70+ @if (icon()) {
71+ <ng-container [ngTemplateOutlet]="icon()!" />
72+ } @else {
73+ <flowbite-icon
74+ svgIcon="flowbite-angular:chevron-up"
75+ class="w-5 h-5" />
76+ }
77+ ` ,
6378 host : {
6479 '(click)' : 'onClick()' ,
6580 } ,
@@ -93,6 +108,10 @@ export class ScrollTopComponent extends BaseComponent<ScrollTopClass> implements
93108 * @default bottom-right
94109 */
95110 public position = model ( inject ( FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE ) ) ;
111+ /**
112+ * Set the scroll top icon
113+ */
114+ public icon = model ( inject ( FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE ) ) ;
96115 /**
97116 * Set the custom style for this scroll top
98117 */
0 commit comments