This repository was archived by the owner on Apr 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import reflex_ui as ui
66
77
8+ class State (rx .State ):
9+ seed : int = 0
10+
11+
812def index () -> rx .Component :
913 # Welcome Page (Index)
1014 return rx .el .div (
@@ -53,9 +57,19 @@ def index() -> rx.Component:
5357 on_checked_change = lambda value : rx .toast .success (f"Value: { value } " ),
5458 ),
5559 ui .slider (
60+ value = State .seed ,
61+ on_value_change = State .set_seed ,
5662 on_value_committed = lambda value : rx .toast .success (f"Value: { value } " ),
5763 class_name = "max-w-xs" ,
5864 ),
65+ rx .el .p (
66+ State .seed ,
67+ class_name = "text-secondary-11 text-sm font-medium" ,
68+ ),
69+ ui .gradient_profile (
70+ seed = State .seed ,
71+ class_name = "size-10" ,
72+ ),
5973 ui .switch (
6074 on_checked_change = lambda value : rx .toast .success (f"Value: { value } " ),
6175 ),
@@ -79,7 +93,7 @@ def index() -> rx.Component:
7993 ),
8094 ui .theme_switcher (class_name = "absolute top-4 right-4" ),
8195 class_name = ui .cn (
82- "flex flex-col gap-4 items-center justify-center h-screen" , "bg-secondary-1"
96+ "flex flex-col gap-6 items-center justify-center h-screen" , "bg-secondary-1"
8397 ),
8498 )
8599
Original file line number Diff line number Diff line change 99 "components.base.card" : ["card" ],
1010 "components.base.checkbox" : ["checkbox" ],
1111 "components.base.dialog" : ["dialog" ],
12+ "components.base.gradient_profile" : ["gradient_profile" ],
1213 "components.base.popover" : ["popover" ],
1314 "components.base.scroll_area" : ["scroll_area" ],
1415 "components.base.select" : ["select" ],
Original file line number Diff line number Diff line change 1+ """Gradient profile component."""
2+
3+ from reflex .components .component import Component
4+ from reflex .vars .base import Var
5+
6+ from reflex_ui .components .component import CoreComponent
7+
8+ DEFAULT_CLASS_NAME = "size-4 pointer-events-none rounded-full"
9+
10+
11+ class GradientProfile (CoreComponent ):
12+ """Gradient profile component."""
13+
14+ library = "@carlosabadia/gradient-profile@github:carlosabadia/gradient-profile"
15+
16+ tag = "GradientProfile"
17+
18+ # Seed to generate gradient for
19+ seed : Var [str | int ]
20+
21+ # Available colors
22+ available_colors : Var [list [str ]]
23+
24+ @classmethod
25+ def create (cls , * children , ** props ) -> Component :
26+ """Create the gradient profile component."""
27+ cls .set_class_name (DEFAULT_CLASS_NAME , props )
28+ return super ().create (* children , ** props )
29+
30+
31+ gradient_profile = GradientProfile .create
You can’t perform that action at this time.
0 commit comments