Tauri: Single WebviewWindow or Multiple Windows?
Decide whether to run all UI in one Tauri WebviewWindow with client-side routing or split features across multiple windows. Compare IPC, shared state, and lifecycle before you commit.
18 Apr 2026, 19:47 UTC

The decision: one window or several?
You are building a Tauri desktop application and must choose how to divide the interface. The two supported patterns are: one WebviewWindow that handles every screen through frontend routing, or multiple WebviewWindow instances, each backed by its own OS window and isolated webview context. A webview is the embedded browser control that renders your HTML, CSS, and JavaScript.
Useful takeaway: start with a single WebviewWindow unless you genuinely need two windows visible at the same time or distinct OS window rules per feature. Multiple windows isolate JavaScript state, so any shared data must move through Tauri IPC (inter-process communication) or an explicitly shared Rust store.
Constraints to verify before you choose
- Tauri major version. Window builder methods and capability configuration changed between Tauri 1.x and 2.x. Confirm your installed versions before copying builder code.
- Window labels. Every
WebviewWindowneeds a unique string label. Frontend code targets events and commands by that label. - OS decorations. Default borders, title bars, and transparency behave differently on Windows, macOS, and Linux.
- Plugin namespaces. Tauri plugin commands are global; two plugins cannot safely register the same command name regardless of window strategy.
Option comparison
| Factor | Single WebviewWindow with routing | Multiple WebviewWindow instances |
|---|---|---|
| JavaScript context | One shared context; frontend modules can import each other directly. | Isolated context per window; no direct DOM or variable sharing. |
| Application state | One Rust state handle and one frontend state tree are simpler to keep consistent. | State must be synchronized through commands, events, or a shared Rust store accessed via app_handle. |
| IPC scope | Global handlers and listeners are enough for most communication. | You must address a specific window label when sending events or window-scoped commands. |
| Window lifecycle | One OS window to show, hide, or close. | Independent creation, focus, and close per window; more lifecycle events to manage. |
| OS window controls | One set of decorations, resizability, and transparency settings. | Different settings per window, but exact defaults vary by operating system. |
| Best suited for | Most desktop apps, dashboards, and single-window tools. | Inspector panels, multi-monitor tools, or features that must remain visible together. |
Trade-offs in practice
A single window keeps application state in one place. Your Rust command handlers and frontend state library operate on the same context, and you do not need to marshal data across an IPC boundary just to update a shared setting. The downside is that you only have one OS window. You can still swap views with client-side routing, but you cannot show the settings panel on one monitor while the main workspace stays on another.
Multiple windows give you independent OS windows, but each window runs its own JavaScript environment. A variable set in the main window is invisible to the settings window. To share data, you call a Tauri command that reads or writes a shared Rust store, or you emit an event targeted at a window label. This adds boilerplate and makes large local state harder to migrate later.
Implementation: main window plus a labeled settings window
The following snippets illustrate the structure for a multi-window app. Verify builder method names and capability keys against your installed Tauri version; they are not guaranteed to match every release.
1. Declare windows in Tauri configuration
Edit your Tauri configuration file, typically tauri.conf.json or the equivalent in your project, and give each window a unique label:
{
"tauri": {
"windows": [
{
"label": "main",
"title": "My App",
"width": 800,
"height": 600,
"resizable": true
},
{
"label": "settings",
"title": "Settings",
"width": 400,
"height": 300,
"resizable": false
}
]
}
}
Run this check in your project directory:
cargo tauri info
Expected result: the command prints the Tauri CLI and core versions. Use those versions to select the correct documentation. A mismatch between your code and the installed core can produce builder or capability errors.
2. Create the second window from Rust
In your Rust entry point, typically src/main.rs, create the settings window so it is available when the app starts:
use tauri::Manager;
fn main() {
tauri::Builder::default()
.setup(|app| {
let window = tauri::WebviewWindowBuilder::new(app, "settings", tauri::WebviewWindowUrl::App("/settings".into()))
.build()?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Where to run: compile and run from the project directory with cargo tauri dev. Required permissions: a working Rust toolchain and the Tauri CLI. Risk: if the settings label already exists, window creation fails or behaves unexpectedly depending on the version.
3. Target a window from the frontend
Your frontend can send an event to a specific window by label. This example is illustrative and depends on your frontend bindings version:
import { emit } from '@tauri-apps/api/event';
async function openSettings() {
await emit('settings-open', { source: 'main' });
}
On the Rust side, listen for that event and act on the labeled window:
app.handle().on_window_event(|event| {
if let tauri::window::WindowEvent::Focused(focused) = event.event() {
// version-specific handling omitted
}
});
Expected check: open Developer Tools in each OS window, trigger the event from the main window, and confirm only the settings window logs or reacts to the message. If both windows react, your listener is not scoped to the correct label.
4. Share state through Rust
Because frontend modules cannot import Rust state directly, manage shared data in a Rust struct or Tauri state and expose it through commands. Both windows can invoke the same command, and the command can use app_handle to emit a window-targeted event when the data changes.
Validation steps
- Run
cargo tauri infoand record the Tauri CLI and core versions. - Build a minimal app with one main window and one additional
WebviewWindowwith a unique label. - Send a frontend event to each window label and confirm the correct window receives it.
- Inspect your Tauri configuration or capabilities file for the window and event permissions required by your major version.
Limitations
- Cross-window communication always crosses an IPC boundary; there is no direct shared JavaScript scope.
- Storing large payloads in window-local state makes a later move to multiple windows more difficult.
- Exact window builder methods and configuration keys changed between Tauri major versions; do not port code from Tauri 1.x to 2.x without checking the release notes.
How to check the result
Open the Tauri DevTools or browser Developer Tools for each OS window. Send an event from the frontend to the settings label. The settings window should log the payload, while the main window should not. If you need shared state, invoke a command from both windows and confirm both see the same Rust-managed value.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.