Upgrading RizzyUI

RizzyUI 1.0 targets Rizzy 6, htmx 4.0.1+ and .NET 10. Most of the work of upgrading is Rizzy’s, so start with Upgrading to Rizzy 6. This page lists what changes in RizzyUI itself. The complete reference, with the audit finding behind each change, is the migration guide in the RizzyUI repository, and the changelog lists every change.

Compatibility

RizzyUIRizzyhtmx.NET
1.0.0-preview.46.0.0-preview.44.0.1+10 (apps on 11 work)
1.0.0-preview.36.0.0-preview.34.0.1+10 (apps on 11 work)
1.0.0-preview.26.0.0-preview.34.0.1+10 (apps on 11 work)
1.0.0-preview.16.0.0-preview.34.0.1+10 (apps on 11 work)
0.9.x and earlier5.3.x2.x10

The RizzyUI package depends on Rizzy, which brings the matching Rizzy.Htmx; you do not need to reference Rizzy yourself.

Upgrade steps

  1. Update the packages. Until 1.0.0 is released, include --prerelease and @next:

    dotnet add package RizzyUI --prerelease
    npm install @jalexsocial/rizzyui@next

    htmx.org is no longer a dependency of @jalexsocial/rizzyui. Rizzy’s <RzScripts /> loads htmx; if you bundle htmx yourself, install htmx.org@^4.0.1.

  2. Register Rizzy and RizzyUI. AddRizzy() now also registers htmx support and Razor components. Remove GenerateStyleNonce/InlineStyleNonce from AddHtmx(...).

    builder.Services.AddRizzy();
    builder.Services.AddRizzyUI(config => config.DefaultTheme = RzTheme.ArcticTheme);
  3. Replace the head setup in your root layout. <RzHeadOutlet /> replaces <HeadOutlet /> and <HtmxConfigHeadOutlet />; <RzScripts /> replaces your htmx and rizzy.js script tags. Keep the RizzyUI module after them and remove any hx-ext="rizzy-nonce" attribute.

    <RzHeadOutlet />
    <RzScripts />
    <script type="module" nonce="@Nonce" src="/_content/RizzyUI/js/rizzyui.min.js"></script>

    With a Content Security Policy, load rizzyui-csp.min.js instead.

  4. No <base href="/"> in your layout? Add it, or give Rizzy an absolute script URL: builder.Services.AddRizzy(o => o.ClientScriptUrl = "/_content/Rizzy/js/rizzy.js");

  5. Remove antiforgerySnippet.js. It does nothing with htmx 4; Rizzy 6 attaches the antiforgery token itself.

  6. Update your own htmx markup and event names as described in Upgrading to Rizzy 6. RizzyUI’s components need no change. The one most often missed in RizzyUI apps is the swap modifier show:window:top, which becomes show:top showTarget:window.

Who loads which script

ScriptLoaded by
htmx 4, rizzy.js and Rizzy’s htmx extensions<RzScripts /> (Rizzy)
Alpine.js and its pluginsRizzyUI (rizzyui.min.js / rizzyui-csp.min.js). Do not load Alpine yourself; RizzyUI starts it.
Component codeRizzyUI, on demand, when a component appears on the page
Third-party libraries (Chart.js, Tom Select, flatpickr, …)RizzyUI components, on demand, from pinned CDN URLs with Subresource Integrity. Override RizzyUIConfig.AssetUrls to self-host.

Breaking changes in 1.0.0-preview.1

  • RzButton has no default aria-label. The visible text names the button. Set AssistiveLabel on icon-only buttons; checkers will otherwise report them.
  • RzMarkdown escapes raw HTML by default. Set AllowUnsafeHtml="true" only for Markdown you trust; enabling it for user content allows script injection.
  • Dialog triggers render x-on:click instead of an inline onclick (so they work under a CSP).
  • npm entry points are dist/js/rizzyui.js and dist/js/rizzyui-csp.js.

Behavior you may notice: dialogs and sheets close on Escape and return focus to their trigger (set CloseOnEscape="false" to keep the old behavior); forms and hx-* buttons inside dialogs use htmx; labels no longer render resource keys.

Changes in 1.0.0-preview.4

Apps already on preview.3 may need to adjust for these changes in 1.0.0-preview.4 (release notes). It requires Rizzy 6.0.0-preview.4, which the RizzyUI package brings.

ChangeWhat to do
RzCheckboxGroup, RzRadioGroup, RzCombobox, RzFileInput and RzInputOTP post the model path (Model.Country) instead of the bare nameBind the model with its prefix ([SupplyParameterFromForm], [FromForm(Name = "Model")]), or set Name="Country" on the component
x-data, x-init or x-load on a component, or on the child of an AsChild component, throwsMove application state to an ancestor (<span x-data="..." class="contents">); reach the component with x-syncprop, its events or Rizzy.$data
x-model on a component without a value throwsUse x-syncprop or the component’s events; form inputs, input-group inputs, CommandInput and RzColorSwatch still take x-model
x-show, x-cloak, x-transition on overlay or collapsible content throw; a component’s own x-ref names are reservedOpen and close through the parent component or its events; rename the ref
An x-bind of an attribute the component computes (for example aria-pressed on RzToggle) is dropped with a Development warningSet it through the component’s parameters or state
RzDateEdit has no default aria-labelGive the field a FieldLabel, or set AriaLabel
A custom theme overrides RzCollapsibleBuild its descriptor for RzAsChildComponent<RzCollapsible.Slots>
Constants.Events.Dialog* now hold rz:modal-*Rebuild code that uses them; listeners on the literal rz:dialog-after-open (and the like) never ran: use the constants or rz:modal-*
Constants.CalendarEvents.ChangeView and SelectDate are removedListen for ClickArrow, ClickMonth or ClickYear, ClickDay, or change on an RzCalendarProvider
Carousel buttons sit 48px outside the slides, and slides have a 16px gapLeave room around the carousel (mx-12), or keep the buttons inside with class="left-2" / class="right-2"
RzChart fills its parent’s height instead of a fixed minimumSet a height on the chart or its parent
Date components follow the request cultureSet Locale to keep a fixed language
DataTableSortToggle is named by its labelUpdate tests that found sort buttons by “Sort ascending”
RzAvatar, RzIndicator, FieldError and the file input trigger have no default role or labelSet AriaLabel where an element needs a name; update tests that used the old names
A trigger’s AsChild button child gets type="button"Nothing, unless you relied on it submitting the form: set type="submit" on the child
TableRequestModel is deprecatedBind RzDataTableState with StateInputName

In Development, RizzyUI now logs a warning when a trigger without AsChild wraps a button or link (<DialogTrigger><RzButton>): set AsChild on the trigger.

Changes in 1.0.0-preview.3

Apps already on preview.2 may need to adjust for these changes in 1.0.0-preview.3 (release notes):

ChangeWhat to do
Code-behind Props keep their C# names (InitialCount was converted to initialCount)Use the C# names in modules (this.$props.InitialCount), or keep camelCase for the app with config.CodeBehindPropsSerializerOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web) in AddRizzyUI
RzAlpineComponent renders no scripts; props are in data-rz-propsNothing, unless your code read the props script directly: use this.$props or Rizzy.props(el)
Name on RzAlpineComponent is optionalRemove it unless other markup refers to the component by name
A component passed in For without [RzAlpineCodeBehind] throwsAdd @attribute [RzAlpineCodeBehind] to it
await Alpine.nextTick() in init() to reach a child componentOptional: move that code to ready(), which runs after child components have started
RzProgress: CurrentValue, MinValue, MaxValueRename to Value, Min, Max (Value is double?; null is indeterminate)
RzProgress: Label, LabelPosition, default AriaLabel “Progress Bar”Use a visible label with aria-labelledby (or AriaLabel), ValueText for aria-valuetext, and ProgressLabel for text on the bar
RzProgress theme slots OuterBar, InnerBar and the label slotsStyle instances with class, or override the RzProgress, ProgressIndicator and ProgressLabel theme descriptors
AsChild with plain markup joined conflicting attribute values (id="rzX1 mine")Check AsChild children with an id or other attributes the component also sets: the child’s value now wins

For long-lived pages and caching, add app.MapStaticAssets() (and .WithStaticAssets() on controllers): code-behind modules then load from fingerprinted URLs.

Changes in 1.0.0-preview.2

Apps already on preview.1 may need to adjust for these changes in 1.0.0-preview.2 (release notes):

ChangeWhat to do
RzCombobox sends only value and text for each item to the pageIf an item or option template reads other fields, list them with ItemDataSelector="@(u => new { u.Name, u.Email })"
RzSwitch and RzInputOTP no longer set a default aria-labelLabel them with FieldLabel For or <label for>; pass aria-label when there is no visible label
The toast runtime loads on first useRizzy.toast calls still work immediately; await Rizzy.toast.ready() before code that needs a return value
The CanvasConfetti and SliderScript asset keys are goneRemove them from any ComponentAssetKeys
highlight.js ships common languages onlyRegister vendor/highlightjs/languages/<name>.min.js as an asset for other languages
Element is honored on every componentRemove Element where you passed it without effect
Attributes can override only role, data-slot and typeUse the component’s parameter (for example AriaLabel) instead of the attribute
AsChild: the child’s own classes win Tailwind conflictsCheck AsChild children whose classes conflict with the component’s
Generated ids such as dialog titles are {Id}-titleNothing, unless CSS or scripts matched the old ids; RzIdScope gives deterministic ids

The full list, including fixes and additions such as x-indeterminate, is in the changelog under “1.0.0-preview.2”.

Troubleshooting

SymptomCause and fix
Components render but nothing is interactiveThe RizzyUI module is missing or not type="module", or the console shows a script error. See the RizzyUI Getting Started guide.
Components initialized twiceRemove your own Alpine.js script.
404 for .../_content/Rizzy/js/rizzy.js on nested routesAdd <base href="/"> or set ClientScriptUrl to an absolute URL.
Unsafe htmx requests fail with 400Render <RzHeadOutlet /> before <RzScripts /> and call app.UseAntiforgery().
Icon-only buttons flagged by accessibility checkersSet AssistiveLabel.