Skip to content
English
Exploded view comes with Pro. Its preview shows once you unlock it.

How it works

A technical drawing of a table lamp in six parts, all solids of revolution on one vertical axis, drawn as an axonometric line drawing in neutral tones with the axis as a dash-dot centre line. The separation slider slides the parts apart along the axis and closes them again; the middle of the column stays put, and the shade lifts further than the rest so the diffuser under it comes into view. Numbered callouts on the right name each part and follow it as it moves; choosing one draws that part in the accent colour, and the row under the figure gives its name and size.

Use it for

  • Teach technical drawing: show how an exploded view keeps every part on its axis and in assembly order.
  • Explain how a product goes together in a manual, a course or a product page, part by part.

Look elsewhere when

  • For an assembly that is not built along one axis, or for a model loaded from a CAD file, use a 3D viewer: this figure draws one built-in lamp.

Usage

import React, { useState } from 'react'
import { LampAssemblyScale } from './LampAssemblyScale.jsx'

export function AssemblyLesson() {
  const [apart, setApart] = useState(0.6)
  const [part, setPart] = useState(4)
  return (
    <LampAssemblyScale
      value={apart}
      onChange={(next) => setApart(next)}
      part={part}
      onPartChange={(next) => setPart(next)}
      labels={{ title: 'Exploded view of a table lamp' }}
    />
  )
}

Props

PropTypeDefaultWhat it does
valuenumber—Controlled separation from 0 (assembled) to 1 (fully apart), rounded to two decimals.
defaultValuenumber0.6Starting separation when uncontrolled, and what Reset returns to.
onChange(separation, { reason }) => void—Called with the new separation and a reason: 'press', 'drag', 'tap', 'key', 'cancel' or 'reset'.
partnumber—Controlled index of the chosen part, 0 (base) to 5 (shade). The chosen part is drawn in the accent colour.
defaultPartnumber4Part chosen at first when uncontrolled (4 is the diffuser, which hides under the shade until the parts separate).
onPartChange(index, { reason, name }) => void—Called when a callout is chosen, with the part's index, the reason ('press', 'key' or 'reset') and its name.
stepnumber0.05Separation step for the arrow keys. Shift with an arrow, or Page Up and Page Down, move four steps.
labelsobject—Replaces any built-in text: title, caption, parts (six names, base first), partsLabel, separation, separationText ('{value}'), size ('{d}', '{h}'), partText ('{n}', '{count}') and reset.
localestring'en'Language tag for the percentage and the sizes.
classNamestring—Extra class on the card, for example to set its width (30rem by default, never wider than its container).

Accessibility

  • The callouts are a radio group labelled Parts with one tab stop: arrow keys choose the next or previous part (Up goes up the lamp), Home and End the base and the shade.
  • Separation is a slider: arrows move 5%, Shift with an arrow or Page Up and Page Down 20%, Home and End go to assembled and fully apart. Its value text reads the separation.
  • The chosen part's name and size are a polite live region. Reset is marked unavailable while nothing has changed.
  • Dragging uses pointer capture. On touch, a press on the slider's track changes nothing until the finger moves sideways or lifts, so vertical scrolling is not caught; a cancelled gesture restores the value it started from.
  • Colour is not the only cue: every part has a number and a name, and the chosen one is repeated in words under the figure.

Motion

After a key, a tap or Reset the parts, leaders and callouts glide for --ds-duration-base. While the slider is dragged they follow it directly. With reduced motion every change lands at once.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

LampAssemblyScale.jsxlamp-assembly-scale.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Form inputs
Availability grid comes with Pro. Its preview shows once you unlock it.
Boolean operations comes with Pro. Its preview shows once you unlock it.
Cascader comes with Pro. Its preview shows once you unlock it.