Id Scope

RizzyUI components generate an id for themselves, different on every render. RzIdScope gives the components inside it deterministic ids instead ({Prefix}-1, {Prefix}-2, in render order), so the same markup always renders the same ids. Use it for a fragment that htmx re-renders and swaps (a morph swap matches elements by id, and focus and ARIA references survive) and for snapshot tests. Components with an explicit Id keep it.

Example

Gift wrap
Source
<RzIdScope Prefix="cart">
    <!-- The badge renders id="cart-1" on every render. -->
    <RzBadge>Gift wrap</RzBadge>
</RzIdScope>

Parameters

ParameterTypeDefaultDescription
PrefixstringRequiredThe id prefix, unique on the page and without whitespace. Two scopes with the same prefix render the same ids.
ChildContentRenderFragment?nullThe content whose components get scoped ids.