Skip to content
daisyBlazor

ThemeController

A checkbox or radio input that switches the daisyUI theme of the whole page through CSS alone. Value names the theme; radios sharing a Name pick one of many.
Actions.theme-controller
Cover · <ThemeController>

Choose a theme

Examples

Toggle

The checkbox variant applies Value while checked and falls back to the page theme when unchecked.

website/Examples/Actions/ThemeControllerToggleExample.razor Source

Radio group

Type="ThemeControllerType.Radio" with a shared Name lets the reader choose between several themes.

website/Examples/Actions/ThemeControllerRadioExample.razor Source

API

<ThemeController>

DaisyBlazor

Parameters

  • Checked bool
    = false

    Whether this controller is currently in its active (checked) state. For checkboxes: true = Value theme is active. For radios: true = this option is currently selected.

  • HideInput bool
    = false

    When true the input is visually hidden (no toggle or radio is drawn) so the label content alone acts as the control. Use it for daisyUI's icon swap: set Class="swap swap-rotate" and put elements with the swap-on / swap-off classes in ChildContent.

  • Name string
    = null

    The radio group name. Only used when Type is Radio. All radio theme-controllers that share the same Name are mutually exclusive.

  • Type ThemeControllerType
    = ThemeControllerType.Checkbox

    Whether this controller renders as a checkbox toggle or a radio button. Defaults to Checkbox.

  • Value string
    = required

    The daisyUI theme name this controller activates (e.g. "dark", "cupcake", "horizon"). For the checkbox variant this is the theme applied when checked; unchecked reverts to the page default. For the radio variant this is the theme applied when this option is selected.

  • Class string
    = null

    Extra CSS classes merged onto the root wrapping <label> element.

  • Style string
    = null

    Inline CSS styles applied to the root wrapping <label> element.

Events

  • CheckedChanged EventCallback<bool>

    Raised when the checked state changes.

Content

  • ChildContent RenderFragment

    Content rendered inside the wrapping label: a text label, or swap-on / swap-off icons together with HideInput. Do not nest a Swap component: its own checkbox would take the click instead of the theme-controller input.

Something went wrong while running the docs. Reload