本文へ移動
日本語
「分解図」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

六つの部品からなる卓上ランプの技術図です。部品はすべて同じ鉛直軸上の回転体で、ニュートラルな色の軸測図として描かれ、軸は一点鎖線の中心線です。分離スライダーで部品を軸に沿って離し、また閉じます。列の中央は動かず、シェードは他より大きく持ち上がるので、その下の拡散板が見えてきます。右側の番号付き引出線は各部品の名前を示し、部品の動きに合わせて移動します。一つを選ぶとその部品がアクセント色で描かれ、図の下の行に名前と寸法が出ます。

向いている場面

  • 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.

向かない場面

  • 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.

使い方

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' }}
    />
  )
}

プロパティ

プロパティ型既定値説明
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).

アクセシビリティ

  • 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.

モーション

キー操作、タップ、リセットの後は、部品・引出線・ラベルが --ds-duration-base でなめらかに動きます。スライダーをドラッグしている間はそのまま追従します。視差効果を減らす設定では、すべての変化がすぐに反映されます。

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

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

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

フォーム入力
「空き時間グリッド」は Pro に含まれます。解除するとプレビューが表示されます。
「図形のブール演算」は Pro に含まれます。解除するとプレビューが表示されます。
「カスケード選択」は Pro に含まれます。解除するとプレビューが表示されます。