Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Scaling Policy

ProNew

Set 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

PropTypeDefault
value*ScalingPolicyValue—
onValueChange*(value: ScalingPolicyValue) => void—
currentnumber

How many instances are running now. Marked on the range.

—
limitnumber

The highest number the range can be set to.

50
hourlyCostnumber

What one instance costs per hour, to show the bounds of the bill.

—
nounstring

What is being scaled, and its plural, e.g. "sandbox" and "sandboxes".

"instance"
nounPluralstring`${noun}s`
metricstring

The measure scaling follows, e.g. "CPU".

"CPU"
classNamestring—

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.