@@ -11,7 +11,8 @@ import { BaseComponent } from 'flowbite-angular';
11
11
import { IconComponent , IconRegistry } from 'flowbite-angular/icon' ;
12
12
import { CHEVRON_UP_SVG_ICON } from 'flowbite-angular/utils' ;
13
13
14
- import type { OnInit } from '@angular/core' ;
14
+ import { NgTemplateOutlet } from '@angular/common' ;
15
+ import type { OnInit , TemplateRef } from '@angular/core' ;
15
16
import {
16
17
ChangeDetectionStrategy ,
17
18
Component ,
@@ -31,6 +32,10 @@ export const FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE = new InjectionToken<
31
32
keyof ScrollTopPositions
32
33
> ( 'FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE' ) ;
33
34
35
+ export const FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE = new InjectionToken <
36
+ TemplateRef < unknown > | undefined
37
+ > ( 'FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE' ) ;
38
+
34
39
export const FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE = new InjectionToken <
35
40
DeepPartial < ScrollTopTheme >
36
41
> ( 'FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE' ) ;
@@ -44,6 +49,10 @@ export const scrollTopDefaultValueProvider = makeEnvironmentProviders([
44
49
provide : FLOWBITE_SCROLL_TOP_POSITION_DEFAULT_VALUE ,
45
50
useValue : 'bottom-right' ,
46
51
} ,
52
+ {
53
+ provide : FLOWBITE_SCROLL_TOP_ICON_DEFAULT_VALUE ,
54
+ useValue : undefined ,
55
+ } ,
47
56
{
48
57
provide : FLOWBITE_SCROLL_TOP_CUSTOM_STYLE_DEFAULT_VALUE ,
49
58
useValue : { } ,
@@ -56,10 +65,16 @@ export const scrollTopDefaultValueProvider = makeEnvironmentProviders([
56
65
@Component ( {
57
66
selector : 'flowbite-scroll-top' ,
58
67
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
+ ` ,
63
78
host : {
64
79
'(click)' : 'onClick()' ,
65
80
} ,
@@ -93,6 +108,10 @@ export class ScrollTopComponent extends BaseComponent<ScrollTopClass> implements
93
108
* @default bottom-right
94
109
*/
95
110
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 ) ) ;
96
115
/**
97
116
* Set the custom style for this scroll top
98
117
*/
0 commit comments