diff --git a/examples/example18-live-toggle.fixture.tsx b/examples/example18-live-toggle.fixture.tsx
new file mode 100644
index 0000000..4e674d1
--- /dev/null
+++ b/examples/example18-live-toggle.fixture.tsx
@@ -0,0 +1,60 @@
+import { useState } from "react"
+import { SchematicViewer } from "lib/components/SchematicViewer"
+import { renderToCircuitJson } from "lib/dev/render-to-circuit-json"
+
+export default () => {
+ const [showDebugGrid, setShowDebugGrid] = useState(true)
+ const [showPorts, setShowPorts] = useState(false)
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ,
+ )}
+ debugGrid={showDebugGrid}
+ showSchematicPorts={showPorts}
+ />
+
+ )
+}
diff --git a/lib/components/SchematicViewer.tsx b/lib/components/SchematicViewer.tsx
index 94cc6d0..791abf9 100644
--- a/lib/components/SchematicViewer.tsx
+++ b/lib/components/SchematicViewer.tsx
@@ -123,7 +123,8 @@ export const SchematicViewer = ({
const [editModeEnabled, setEditModeEnabled] = useState(defaultEditMode)
const [snapToGrid, setSnapToGrid] = useState(true)
- const [showGrid, setShowGrid] = useState(debugGrid)
+ const [showGridInternal, setShowGridInternal] = useState(false)
+ const showGrid = debugGrid || showGridInternal
const [isInteractionEnabled, setIsInteractionEnabled] = useState(
!clickToInteractEnabled,
)
@@ -513,7 +514,7 @@ export const SchematicViewer = ({
}
}}
showGrid={showGrid}
- onToggleGrid={setShowGrid}
+ onToggleGrid={setShowGridInternal}
/>
{spiceSimulationEnabled && (
setShowSpiceOverlay(true)} />