Theme Controller
Clicky clicky
Class Reference Theme controller changes the theme using CSS only. You can then use JS to save the input state in the server or localStorage if you want it to persist on page refresh.
Basic
Input(
type='checkbox',
value='synthwave',
cls='toggle theme-controller'
)
Auto-import documentation coming soon...
Input(type='checkbox', value='synthwave', cls='checkbox theme-controller')
Auto-import documentation coming soon...
Text Icons
Label(
"Default",
Input(type="checkbox", cls="toggle mx-2 theme-controller", value="synthwave"),
"Synthwave",
cls="flex cursor-pointer gap-2 items-center"
)
Auto-import documentation coming soon...
Styling
Input Types
THEMES = ["default", "retro", "cyberpunk", "valentine", "aqua"]
radio_attrs = {
"type": "radio",
"name": "theme-radios",
"cls": "radio radio-smtheme-controller"
}
return Fieldset(
*(Label(
Input(
value=theme,
checked=(theme == "default"),
**radio_attrs
),
theme.capitalize(),
cls="flex gap-2 cursor-pointer items-center"
) for theme in THEMES),
cls="fieldset"
)
Auto-import documentation coming soon...
Theme
THEMES = ["default", "retro", "cyberpunk", "valentine", "aqua"]
input_attrs = {
"type": "radio",
"name": "theme-dropdown",
"cls": "theme-controller btn btn-sm btn-block btn-ghost justify-start"
}
return Div(
Div(
"Theme",
Icon.down_caret(),
tabindex="0",
role="button",
cls="btn m-1"
),
Ul(
*(Li(Input(
value=theme,
aria_label=theme.capitalize(),
checked=(theme == "default"),
**input_attrs
)) for theme in THEMES),
tabindex="0",
cls="dropdown-content bg-base-300 rounded-box z-[1] w-52 p-2 shadow-2xl"
),
cls="dropdown mb-72"
)
Auto-import documentation coming soon...
Class Reference
Class | Type | Description |
---|---|---|
theme-controller | Component | Base controller class for theme inputs |
Do you have a question? ask the community
Do you see a bug? open an issue on GitHub
LLMs Context: Full Markdown | This Component