File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/htpy_uikit/components Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 11from htpy import Renderable
22from htpy import i as i_el
33from htpy import script
4+ from markupsafe import Markup
45from sourcetypes import js
56
67from ._types_lucide import LucideName
@@ -46,3 +47,18 @@ def lucide_auto_init_script() -> Renderable:
4647 lucide.createIcons();
4748 """
4849 return script ()[code ]
50+
51+
52+ def lucide_htmx_init_script () -> Renderable :
53+ """Return a <script> tag that initializes Lucide icons after HTMX content swaps.
54+
55+ This listens for HTMX's 'htmx:afterSwap' event and re-initializes Lucide icons
56+ for any new content that was swapped in. Place this once, near the end of <body>
57+ or in your layout/template head.
58+ """
59+ code : js = """
60+ document.addEventListener('htmx:afterSwap', function(evt) {
61+ lucide.createIcons();
62+ });
63+ """
64+ return script ()[Markup (code )]
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def switch(
4747 # Inline full tailwind classes from reference for switches.
4848 # Color-specific classes are appended based on `color`.
4949 base_switch_classes = (
50- "input appearance-none focus-visible:border-ring focus-visible:ring-ring/50 "
50+ "input cursor-pointer appearance-none focus-visible:border-ring focus-visible:ring-ring/50 "
5151 "inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border "
5252 "border-border shadow-xs transition-all outline-none focus-visible:ring-[3px] "
5353 "disabled:cursor-not-allowed disabled:opacity-50 bg-input dark:bg-input/80 "
You can’t perform that action at this time.
0 commit comments