@@ -16,6 +16,7 @@ def options(
16
16
spinner_color : str | None = None ,
17
17
spinner_size : str | None = None ,
18
18
spinner_delay : str | None = None ,
19
+ spinner_selector : str | None = None ,
19
20
pulse_background : str | None = None ,
20
21
pulse_height : str | None = None ,
21
22
pulse_speed : str | None = None ,
@@ -36,6 +37,10 @@ def options(
36
37
The amount of time to wait before showing the spinner. This can be any valid
37
38
CSS time and can useful for not showing the spinner if the computation
38
39
finishes quickly.
40
+ spinner_selector
41
+ A CSS selector for scoping the spinner customization.
42
+ This can be useful if you want to have different spinners for different
43
+ parts of the app. Defaults to the root document element.
39
44
pulse_background
40
45
A CCS background definition for the pulse. The default uses a
41
46
[linear-gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient)
@@ -55,6 +60,7 @@ def options(
55
60
color = spinner_color ,
56
61
size = spinner_size ,
57
62
delay = spinner_delay ,
63
+ selector = spinner_selector ,
58
64
),
59
65
pulse_options (
60
66
background = pulse_background ,
@@ -69,8 +75,9 @@ def spinner_options(
69
75
color : str | None = None ,
70
76
size : str | None = None ,
71
77
delay : str | None = None ,
78
+ selector : str | None = None ,
72
79
) -> TagChild :
73
- if color is None and size is None and delay is None :
80
+ if color is None and size is None and delay is None and selector is None :
74
81
return None
75
82
76
83
css_vars = (
@@ -79,7 +86,10 @@ def spinner_options(
79
86
+ (f"--shiny-spinner-delay: { delay } ;" if delay else "" )
80
87
)
81
88
82
- return tags .style (":root {" + css_vars + "}" )
89
+ if selector is None :
90
+ selector = ":root"
91
+
92
+ return tags .style (f"{ selector } {{ { css_vars } }}" )
83
93
84
94
85
95
def pulse_options (
0 commit comments