# Magnetic bearing

Four opposed electromagnets centre a rotor across a visible air gap. Offset moves the unsupported rotor and changes the opposing correction emphasis.

> 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/magnetic-bearing.json
```

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

## Notes

- Coil emphasis only explains feedback direction. The component does not simulate magnetic force, rotor dynamics, stability or a controller.

## Usage

```tsx
import { MagneticBearing } from "@/components/ui/magnetic-bearing"

<MagneticBearing behavior="balance" axis="x" view="iso" />
<MagneticBearing offset={0.5} axis="y" interactive />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `offset` | `number` | — | Controlled bipolar rotor displacement from −1 to 1. |
| `behavior` | `"balance" | "disturb" | "static"` | `"balance"` | Small correction or large disturbance motion. |
| `axis` | `"x" | "y"` | `"x"` | Displayed correction axis. |
| `interactive / onOffsetChange` | `boolean / (offset: number) => void` | — | Displace the rotor and report the bounded offset. |
| `showField` | `boolean` | `true` | Show qualitative field rings across the air gap. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One magnetic bearing, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `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/magnetic-bearing.tsx`
