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
| RizzyUI | Rizzy | htmx | .NET |
|---|---|---|---|
| 1.0.0-preview.4 | 6.0.0-preview.4 | 4.0.1+ | 10 (apps on 11 work) |
| 1.0.0-preview.3 | 6.0.0-preview.3 | 4.0.1+ | 10 (apps on 11 work) |
| 1.0.0-preview.2 | 6.0.0-preview.3 | 4.0.1+ | 10 (apps on 11 work) |
| 1.0.0-preview.1 | 6.0.0-preview.3 | 4.0.1+ | 10 (apps on 11 work) |
| 0.9.x and earlier | 5.3.x | 2.x | 10 |
The RizzyUI package depends on Rizzy, which brings the matching Rizzy.Htmx; you do not need
to reference Rizzy yourself.
Upgrade steps
Update the packages. Until 1.0.0 is released, include
--prereleaseand@next:dotnet add package RizzyUI --prerelease npm install @jalexsocial/rizzyui@nexthtmx.orgis no longer a dependency of@jalexsocial/rizzyui. Rizzy’s<RzScripts />loads htmx; if you bundle htmx yourself, installhtmx.org@^4.0.1.Register Rizzy and RizzyUI.
AddRizzy()now also registers htmx support and Razor components. RemoveGenerateStyleNonce/InlineStyleNoncefromAddHtmx(...).builder.Services.AddRizzy(); builder.Services.AddRizzyUI(config => config.DefaultTheme = RzTheme.ArcticTheme);Replace the head setup in your root layout.
<RzHeadOutlet />replaces<HeadOutlet />and<HtmxConfigHeadOutlet />;<RzScripts />replaces your htmx andrizzy.jsscript tags. Keep the RizzyUI module after them and remove anyhx-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.jsinstead.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");Remove
antiforgerySnippet.js. It does nothing with htmx 4; Rizzy 6 attaches the antiforgery token itself.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 becomesshow:top showTarget:window.
Who loads which script
| Script | Loaded by |
|---|---|
htmx 4, rizzy.js and Rizzy’s htmx extensions | <RzScripts /> (Rizzy) |
| Alpine.js and its plugins | RizzyUI (rizzyui.min.js / rizzyui-csp.min.js). Do not load Alpine yourself; RizzyUI starts it. |
| Component code | RizzyUI, 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
RzButtonhas no defaultaria-label. The visible text names the button. SetAssistiveLabelon icon-only buttons; checkers will otherwise report them.RzMarkdownescapes raw HTML by default. SetAllowUnsafeHtml="true"only for Markdown you trust; enabling it for user content allows script injection.- Dialog triggers render
x-on:clickinstead of an inlineonclick(so they work under a CSP). - npm entry points are
dist/js/rizzyui.jsanddist/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.
| Change | What to do |
|---|---|
RzCheckboxGroup, RzRadioGroup, RzCombobox, RzFileInput and RzInputOTP post the model path (Model.Country) instead of the bare name | Bind 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, throws | Move 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 throws | Use 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 reserved | Open 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 warning | Set it through the component’s parameters or state |
RzDateEdit has no default aria-label | Give the field a FieldLabel, or set AriaLabel |
A custom theme overrides RzCollapsible | Build 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 removed | Listen for ClickArrow, ClickMonth or ClickYear, ClickDay, or change on an RzCalendarProvider |
| Carousel buttons sit 48px outside the slides, and slides have a 16px gap | Leave 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 minimum | Set a height on the chart or its parent |
| Date components follow the request culture | Set Locale to keep a fixed language |
DataTableSortToggle is named by its label | Update tests that found sort buttons by “Sort ascending” |
RzAvatar, RzIndicator, FieldError and the file input trigger have no default role or label | Set 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 deprecated | Bind 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):
| Change | What 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-props | Nothing, unless your code read the props script directly: use this.$props or Rizzy.props(el) |
Name on RzAlpineComponent is optional | Remove it unless other markup refers to the component by name |
A component passed in For without [RzAlpineCodeBehind] throws | Add @attribute [RzAlpineCodeBehind] to it |
await Alpine.nextTick() in init() to reach a child component | Optional: move that code to ready(), which runs after child components have started |
RzProgress: CurrentValue, MinValue, MaxValue | Rename 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 slots | Style 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):
| Change | What to do |
|---|---|
RzCombobox sends only value and text for each item to the page | If 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-label | Label them with FieldLabel For or <label for>; pass aria-label when there is no visible label |
| The toast runtime loads on first use | Rizzy.toast calls still work immediately; await Rizzy.toast.ready() before code that needs a return value |
The CanvasConfetti and SliderScript asset keys are gone | Remove them from any ComponentAssetKeys |
| highlight.js ships common languages only | Register vendor/highlightjs/languages/<name>.min.js as an asset for other languages |
Element is honored on every component | Remove Element where you passed it without effect |
Attributes can override only role, data-slot and type | Use the component’s parameter (for example AriaLabel) instead of the attribute |
AsChild: the child’s own classes win Tailwind conflicts | Check AsChild children whose classes conflict with the component’s |
Generated ids such as dialog titles are {Id}-title | Nothing, 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
| Symptom | Cause and fix |
|---|---|
| Components render but nothing is interactive | The RizzyUI module is missing or not type="module", or the console shows a script error. See the RizzyUI Getting Started guide. |
| Components initialized twice | Remove your own Alpine.js script. |
404 for .../_content/Rizzy/js/rizzy.js on nested routes | Add <base href="/"> or set ClientScriptUrl to an absolute URL. |
| Unsafe htmx requests fail with 400 | Render <RzHeadOutlet /> before <RzScripts /> and call app.UseAntiforgery(). |
| Icon-only buttons flagged by accessibility checkers | Set AssistiveLabel. |