A modular suite of textbook-grade chemistry & physics apparatus and circuit visualizers for React. Built with pure scalable vector graphics (SVG) and TypeScript, designed specifically for STEM education platforms, digital textbooks, online quizzes, and interactive scientific applications.
- Textbook Quality: Crisp, vector-rendered lab apparatus and schematics matching collegiate and high-school STEM curriculum diagrams.
- Pure SVG Rendering: Infinite scalability without pixelation or heavy raster dependencies.
- Diagram-Only Focus: Renders purely the visual apparatus or circuit without forced wrappers, sidebars, or headers.
- Configurable Annotations: Toggle leader callout lines, labels, measurement scales, and current flows with single props.
- Strongly Typed: 100% TypeScript with comprehensive interfaces for each visualizer.
- Zero Runtime Dependencies: Lightweight and responsive SVG viewboxes that scale naturally to any container or screen size.
npm install react-chemlabImport chemistry or physics components directly and embed them in your React application:
import {
GalvanicCell,
TitrationSetup,
DCCircuit,
WheatstoneBridge,
LogicCircuit,
RayOptics,
SimplePendulum
} from 'react-chemlab'
export function ScienceDashboard() {
return (
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 p-6">
<DCCircuit
voltage={12}
resistance={10}
switchClosed={true}
showVoltmeter={true}
showAmmeter={true}
showBulb={true}
showCallouts={true}
/>
<WheatstoneBridge
r1={100}
r2={100}
r3={200}
rx={200}
voltage={10}
showGalvanometerDeflection={true}
showBalanceEquation={true}
/>
<LogicCircuit
gateType="AND"
inputA={1}
inputB={1}
showTruthTable={true}
showCallouts={true}
/>
<RayOptics
lensType="convex"
focalLength={50}
objectDistance={80}
objectHeight={40}
showRays={true}
showFormula={true}
/>
<SimplePendulum
stringLength={1.0}
angleDegrees={25}
bobMass={0.5}
showForceVectors={true}
showFormula={true}
/>
<GalvanicCell
anodeElement="Zn"
cathodeElement="Cu"
voltage={1.10}
showCallouts={true}
/>
</div>
)
}interface DCCircuitProps {
voltage?: number
resistance?: number
switchClosed?: boolean
showVoltmeter?: boolean
showAmmeter?: boolean
showBulb?: boolean
showCallouts?: boolean
showCurrentFlow?: boolean
animated?: boolean
width?: number | string
height?: number | string
className?: string
}interface WheatstoneBridgeProps {
r1?: number
r2?: number
r3?: number
rx?: number
voltage?: number
showGalvanometerDeflection?: boolean
showBalanceEquation?: boolean
showCallouts?: boolean
width?: number | string
height?: number | string
className?: string
}interface RLCCircuitProps {
resistance?: number
inductance?: number
capacitance?: number
frequency?: number
voltage?: number
showPhasorSummary?: boolean
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
className?: string
}interface MeterBridgeProps {
resistanceR?: number
balanceLengthL?: number
unknownResistanceS?: number
driverVoltage?: number
showCallouts?: boolean
showFormula?: boolean
width?: number | string
height?: number | string
className?: string
}interface LogicCircuitProps {
gateType?: 'AND' | 'OR' | 'NAND' | 'NOR' | 'XOR' | 'NOT'
inputA?: 0 | 1
inputB?: 0 | 1
showTruthTable?: boolean
showCallouts?: boolean
width?: number | string
height?: number | string
className?: string
}interface RayOpticsProps {
lensType?: 'convex' | 'concave'
focalLength?: number
objectDistance?: number
objectHeight?: number
showRays?: boolean
showLabels?: boolean
showCallouts?: boolean
showFormula?: boolean
width?: number | string
height?: number | string
className?: string
}interface SimplePendulumProps {
stringLength?: number
angleDegrees?: number
bobMass?: number
showForceVectors?: boolean
showTrajectoryArc?: boolean
showFormula?: boolean
showCallouts?: boolean
width?: number | string
height?: number | string
className?: string
}interface GalvanicCellProps {
anodeElement?: string
cathodeElement?: string
anodeConcentration?: number
cathodeConcentration?: number
voltage?: number
showLabels?: boolean
showCallouts?: boolean
showElectronFlow?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface ElectrolyticCellProps {
voltage?: number
current?: number
electrolyte?: string
anodeReaction?: string
cathodeReaction?: string
showLabels?: boolean
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface TitrationSetupProps {
titrant?: string
analyte?: string
buretteVolume?: string
endpointReached?: boolean
indicatorColor?: string
showStirrer?: boolean
showDroplets?: boolean
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface SpectrophotometerProps {
wavelength?: number
absorbance?: number
transmittance?: number
sampleName?: string
sampleColor?: string
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface PaperChromatographyProps {
spots?: Array<{
name: string
rf: number
color: string
}>
solvent?: string
solventFront?: number
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface BohrModelProps {
element?: string
symbol?: string
atomicNumber?: number
shells?: number[]
protons?: number
neutrons?: number
showQuantumJump?: boolean
jumpShell?: number
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface OrbitalDiagramProps {
element?: string
electronConfiguration?: string
subshells?: Array<{
name: string
boxes: number
electrons: number
energyLevel: number
}>
showCallouts?: boolean
width?: number | string
height?: number | string
}interface CalorimeterProps {
reactionType?: string
initialTemp?: number
finalTemp?: number
massWater?: number
heatCapacity?: number
heatExchange?: number
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}interface ReactionEnergyProfileProps {
reactantEnergy?: number
productEnergy?: number
activationEnergy?: number
catalyzedActivationEnergy?: number
showCatalyst?: boolean
reactionLabel?: string
showCallouts?: boolean
width?: number | string
height?: number | string
}interface PhaseDiagramProps {
substance?: string
triplePointTemp?: number
triplePointPress?: number
criticalPointTemp?: number
criticalPointPress?: number
isWater?: boolean
showCallouts?: boolean
width?: number | string
height?: number | string
}interface GasPistonProps {
pressure?: number
volume?: number
temperature?: number
gasName?: string
particleCount?: number
hasFlame?: boolean
showCallouts?: boolean
animated?: boolean
width?: number | string
height?: number | string
}Clone this repository to run the local interactive laboratory and test each component live:
git clone https://github.com/adhil72/react-chemlab.git
cd react-chemlab
npm install
npm run devThe interactive gallery will run at http://localhost:5173/, allowing you to inspect each study across chemistry, circuits, optics, and mechanics.
To run lint checks and production builds:
npm run lint
npm run build
















