Usage Limit & Upgrade Modal

UsageLimit shows the usage of a license property (e.g. "Usage: 1/2") with an upgrade button next to it. Clicking the button opens UpgradeModal, which loads the billing component of HYVOR Core (plans and add-ons) focused on the given license property. Both must be used inside CloudContext.

import { UsageLimit } from '@hyvor/design/cloud';

<UsageLimit
    used={languages.length}
    limit={license.languages}
    focus="languages"
    label="Languages"
/>

Nothing is rendered when the limit is -1, null, or undefined (unlimited), or when the deployment is not cloud (unless showOnPrem is set). The count turns red when the limit is reached.

UsageLimit properties

Name
Default
Description
used
Current usage.
limit
The limit. -1, null, or undefined = unlimited.
focus
The license property (key in the license, e.g. languages). Plans and add-ons for this property are highlighted in the modal.
label
Usage
Text before the numbers.
buttonText
Upgrade
Text of the button.
modalTitle
buttonText
Title of the modal (string or snippet).
component
CloudContext component
The component whose billing is shown (e.g. blogs).
buttonSize
small
Size of the button.
modalSize
large
Size of the modal.
showOnPrem
false
Render even if the deployment is not cloud.
format
String
Formats the numbers (e.g. for bytes).

UpgradeModal

Use UpgradeModal directly to open the upgrade flow from anywhere (e.g. a "limit reached" message).

import { UpgradeModal } from '@hyvor/design/cloud';

let show = $state(false);

{#if show}
    <UpgradeModal bind:show focus="blogs" title="Blogs" />
{/if}
Name
Default
Description
show
Bindable. Whether the modal is open.
focus
The license property to highlight.
title
Upgrade
Modal title (string or snippet).
component
CloudContext component
The component whose billing is shown.
size
large
Modal size.
params
{}
Extra query params sent to the billing component script.
scriptPath
/js/billing-component-iframe.js
Path of the billing script on the HYVOR instance.
onclose
Called when the modal is closed.