Skip to main content
Clever Ops

Beam Balance

A working two-pan beam balance for React, place mono weight chips on either pan, the beam tips with damped torque physics, and equilibrium earns the lamp. Tailwind tokens.

Preview & code

Loading Beam Balance preview

Installation

pnpm dlx shadcn@latest add @cleverui/beam-balance

Requires the @cleverui registry in your components.json, a one-off, two-line setup.

Usage

tsx
import { BeamBalance } from '@/components/ui/beam-balance'
Exampletsx
import { BeamBalance } from '@/components/ui/beam-balance'

export default function BeamBalanceDemo() {
  return (
    <div className="mx-auto w-full max-w-lg px-4 py-10 sm:px-6 sm:py-14">
      <p className="mb-4 font-mono text-[11px] uppercase tracking-[0.2em] text-muted-foreground sm:text-xs">
        Spectacle · statics lab
      </p>
      <h2 className="mb-6 text-2xl font-semibold tracking-tight text-balance sm:text-3xl">
        Stack weights until the needle rests on zero.
      </h2>
      <BeamBalance
        weights={[1, 2, 5, 10, 20]}
        unit="g"
        ariaLabel="Laboratory beam balance"
      />
      <p className="mt-4 text-sm leading-relaxed text-muted-foreground">
        Cycle each chip tray → left → right → tray. Match both pans and the
        equilibrium lamp lights, torque is honest, grams are quantized.
      </p>
    </div>
  )
}

API reference

BeamBalance accepts the following props.

PropTypeDefaultDescription
weightsnumber[]DEFAULT_WEIGHTSweight denominations in the tray
unitstring'g'mono unit suffix on chips and readouts
ariaLabelstring'Beam balance'accessible name for the instrument group

…plus everything from React.HTMLAttributes<HTMLDivElement>: className, event handlers, aria attributes and the rest pass straight through.

Frequently asked questions

How do I install the Beam Balance component?

Register the @cleverui registry in your components.json ("@cleverui": "https://cleverops.com.au/r/{name}.json"), then run `npx shadcn@latest add @cleverui/beam-balance`. The shadcn CLI copies the source into your project, you own the code from that point. You can also copy the source directly from this page.

What dependencies does Beam Balance require?

Beam Balance uses motion on top of React and Tailwind CSS. You don't need to install it manually, the shadcn CLI resolves and installs npm dependencies automatically when you add the component.

Can I theme Beam Balance to match my brand?

Yes. The component is styled entirely with Tailwind utilities over standard design tokens (primary, background, muted, border), so it inherits your existing shadcn/ui theme automatically. Change your CSS variables and the component follows, no source edits needed for palette, radius, or fonts.

Want this built for you?

CleverUI is built by the Clever Ops web team. If you'd rather ship a hand-coded, fast, custom website than assemble one, we build them for Australian businesses every week.

Explore web development services