Dashboard Core — Circuit Builder Component¶
Graphical (drag-and-drop) circuit builder — the fourth pillar of IBM Quantum Composer's layout (graphical editor + code editor + statevector view + results) reproduced natively for this project's own dashboard.
circuit_builder_component ¶
Graphical (drag-and-drop) circuit builder -- the fourth pillar of IBM Quantum Composer's layout (graphical editor + code editor + Statevector + Probabilities), the one missing piece the rest of dashboard_core didn't have yet.
Built on Streamlit's own native bidirectional component API (st.components.v2.component -- real HTML/CSS/JS running in the browser, not a hand-waved "coming soon" panel). Gates are dragged from a palette onto a qubit x time-step grid using plain HTML5 drag-and-drop; every drop re-serializes the grid into an ops list and pushes it back to Python via setStateValue, so Streamlit always has the real current state of what's on the canvas.
The ops list this emits is consumed by dashboard_core.graphical_builder. ops_to_native_tuples, which builds dense_evolution's own gate tuples (no Qiskit) executed by the exact same dense_evolution engine as typed OpenQASM -- no separate/fake execution path for graphically-built circuits.
mount_circuit_builder ¶
Mount the drag-and-drop circuit builder and return its current ops list (list[dict] with 'gate'/'qubits'), or [] if nothing is placed yet.
key should change whenever n_qubits changes (e.g. include it in the
caller's key) so Streamlit mounts a fresh grid instead of reusing a
stale one sized for a different qubit count.
Streamlit is imported here, not at module level: this component only means anything inside a Streamlit app (app_dashboard.py) -- the Composer kernel (local_site/app/server.py) imports dashboard_core too but never calls this function, and shouldn't need streamlit installed just to start.
Source code in tools/dashboard_core/circuit_builder_component.py
See also: dashboard_core.graphical_builder,
which converts this component's output into runnable gate tuples.