| Crates.io | tauri-nssplitview |
| lib.rs | tauri-nssplitview |
| version | 0.1.0 |
| created_at | 2025-10-07 06:21:42.719475+00 |
| updated_at | 2025-10-07 06:21:42.719475+00 |
| description | A wrapper plugin for Tauri to build MacOS app with NSSplitView |
| homepage | |
| repository | https://github.com/Vanalite/tauri-nssplitview |
| max_upload_size | |
| id | 1871255 |
| size | 183,401 |
Create macOS split views for your Tauri app using native NSSplitView. Build applications with multiple views where one or more use native macOS split view functionality alongside standard Tauri webviews.
Split views are a native macOS UI component (NSSplitView) that allows you to divide a window into multiple resizable panes. This plugin enables you to create hybrid Tauri applications where some views use native macOS split view capabilities while others use standard webview-based rendering.
Add to your Cargo.toml:
[dependencies]
tauri = { version = "2.8", features = ["macos-private-api"] }
tauri-nssplitview = { git = "https://github.com/Vanalite/tauri-nssplitview" }
fn main() {
tauri::Builder::default()
.plugin(tauri_nssplitview::init())
.setup(|app| {
// Your setup code here
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Basic usage - Convert a window to a split view:
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
use tauri_nssplitview::{BasicSplitView, WebviewWindowExt};
// In your setup function
let window = WebviewWindowBuilder::new(
app,
"main",
WebviewUrl::App("index.html".into()),
)
.title("My Split View App")
.inner_size(800.0, 600.0)
.build()?;
// Convert to split view
let split_view = window.to_split_view::<BasicSplitView>()?;
// The window now has a split view with the original webview as the first pane
split_view.show();
use tauri::Manager;
use tauri_nssplitview::ManagerExt;
#[tauri::command]
fn get_split_info(app: tauri::AppHandle) -> Result<String, String> {
match app.get_split_view("main") {
Ok(split_view) => {
Ok(format!(
"Panes: {}, Vertical: {}, Visible: {}",
split_view.pane_count(),
split_view.is_vertical(),
split_view.is_visible()
))
}
Err(_) => Err("Split view not found".to_string()),
}
}
#[tauri::command]
fn set_divider(app: tauri::AppHandle, position: f64) -> Result<(), String> {
match app.get_split_view("main") {
Ok(split_view) => {
split_view.set_divider_position(0, position);
Ok(())
}
Err(_) => Err("Split view not found".to_string()),
}
}
// Visibility
split_view.show();
split_view.hide();
split_view.is_visible() -> bool
// Layout
split_view.is_vertical() -> bool
split_view.pane_count() -> usize
// Divider Control
split_view.set_divider_position(divider_index: usize, position: f64);
split_view.get_divider_position(divider_index: usize) -> f64;
split_view.divider_thickness() -> f64;
// Pane Access
split_view.pane_at_index(index: usize) -> Option<Retained<NSView>>;
split_view.is_pane_collapsed(index: usize) -> bool;
// Conversion
split_view.to_window() -> Option<WebviewWindow>;
split_view.label() -> &str;
use tauri_nssplitview::ManagerExt;
// Get split view by label
let split_view = app.get_split_view("main")?;
// Remove split view
app.remove_split_view("main");
use tauri_nssplitview::WebviewWindowExt;
// Convert any Tauri window to a split view
let split_view = window.to_split_view::<BasicSplitView>()?;
macOS only - This plugin uses native macOS APIs (NSSplitView from AppKit) and requires:
macos-private-api feature enabledCheck out the examples directory:
To run the example:
cd examples/basic-splitview
cargo tauri dev
Split views are ideal for:
The plugin:
macos-private-api feature enabled in TauriContributions welcome! Please:
MIT or Apache-2.0 where applicable.
Based on the architecture of tauri-nspanel.