Scaling Policy
ProNewSet how a pool scales: a two-thumb slider for the fewest and most instances with the number running now marked on it, a target utilization, and a sentence that reads the policy and its hourly cost back.
Installation
pnpm dlx shadcn@latest add @viewport/scaling-policy
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| value* | ScalingPolicyValue | — |
| onValueChange* | (value: ScalingPolicyValue) => void | — |
| current | numberHow many instances are running now. Marked on the range. | — |
| limit | numberThe highest number the range can be set to. | 50 |
| hourlyCost | numberWhat one instance costs per hour, to show the bounds of the bill. | — |
| noun | stringWhat is being scaled, and its plural, e.g. "sandbox" and "sandboxes". | "instance" |
| nounPlural | string | `${noun}s` |
| metric | stringThe measure scaling follows, e.g. "CPU". | "CPU" |
| className | string | — |
Accessibility
- Three named sliders with arrow-key steps.
- The summary sentence is announced as the policy changes.
- It says in words when the pool is at its floor or ceiling, and warns about cold starts at zero.
- Respects prefers-reduced-motion.