# Leg press

A sled on inclined rails: only the component of the load along the rails resists, so the rail angle is the resistance and the frame decides the weight.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/leg-press.json
```

Registry item: `leg-press` · [`https://robocn.dev/r/leg-press.json`](https://robocn.dev/r/leg-press.json)

## Notes

- Solved: the load. Only the component of the weight that lies along the rails resists, so the sled load is `weight · sin(railAngle)` — 30 degrees hands back half the plates, 45 degrees 0.71 of them, and flat rails nothing at all. The two lines drawn under the sled are those two vectors.
- The load is never a prop. Change `railAngle` and read it back off the accessible label. This is the only machine in the family where changing the frame changes the weight, which is why a leg press number does not compare with anyone else's.
- The travel does not change the load — the sled weighs the same everywhere on the rails. Only the frame moves that number.
- Illustrated: frictionless. No rail friction, no roller drag, no bearing loss, and no dynamics — this is what the sled weighs standing still on the rails.
- The framing follows the rail angle, because that is a thing somebody bolted together; it never follows the travel, so it cannot breathe as the machine works.
- Design note: docs/gym-machines.md.

## Usage

```tsx
import { LegPress } from "@/components/ui/leg-press"

// Runs its own set.
<LegPress behavior="press" />

// Lay the frame down and the same plates weigh less along the rails.
<LegPress railAngle={20} plates={4} />

// Or drive the sled, which stops the loop.
<LegPress travel={0.6} onTravelChange={setTravel} interactive />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `travel` | `number` | — | Travel along the rails, 0 racked at the bottom to 1 fully extended. Supplying it stops the loop. Named for the rails rather than for the rep, because `stroke` is an SVG attribute this component passes through. |
| `onTravelChange` | `(travel: number) => void` | — | Fires while it is dragged or keyed, so interaction works in controlled mode too. |
| `behavior` | `"press" | "partials" | "hold" | "static"` | `"press"` | What it does with nobody driving it. |
| `railAngle` | `number` | `38` | The rails' inclination from horizontal, in degrees. This is the resistance: the load along the rails is the weight times its sine. |
| `plates` | `number` | `3` | Discs on the loading horns, per side. |
| `plateWeight` | `number` | `20` | What one disc weighs, for the readout in the accessible label. |
| `interactive` | `boolean` | `false` | Hand it to a person: drag across it, or focus it and use the arrow keys. It eases back into the behaviour on release. |
| `showGround` | `boolean` | `true` | Draw the contact shadow and the ground line beneath it. |
| `label` | `string` | — | Optional technical caption under the drawing. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One machine, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `speed` | `number` | `0.32` | Cycles per second. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/leg-press.tsx`
