Crate dioxus_mosaic

Crate dioxus_mosaic 

Source
Expand description

§dioxus-mosaic

A React-Mosaic-style tiling window manager library for Dioxus applications.

§Features

  • HashMap-based architecture - O(1) operations for smooth 60 FPS performance
  • Binary splits - Simple, proven pattern (like VSCode, Sublime)
  • Resizable dividers - Drag to resize panes
  • Dynamic splitting - Split any tile horizontally or vertically
  • Panel controls - Close tiles, collapse/expand
  • LocalStorage persistence - Layout survives page reloads
  • Clean builder API - Easy-to-use tree-like configuration

§Quick Start

use dioxus::prelude::*;
use dioxus_mosaic::{Mosaic, MosaicBuilder, tile};

#[component]
fn App() -> Element {
    let mut layout = use_signal(|| {
        MosaicBuilder::horizontal()
            .left(tile("sidebar"))
            .right(tile("editor"))
            .split(25.0)
            .build()
    });

    rsx! {
        Mosaic {
            layout: layout,
            render_tile: move |tile_id| {
                match tile_id.as_str() {
                    "sidebar" => rsx! { div { "Sidebar" } },
                    "editor" => rsx! { div { "Editor" } },
                    _ => None
                }
            },
        }
    }
}

Re-exports§

pub use drag_drop::DragGhost;
pub use drag_drop::DragGhost;
pub use split_pane::SplitPane;
pub use split_pane::SplitPane;
pub use tile_pane::TilePane;
pub use tile_pane::TilePane;

Structs§

DragState
Global drag state
MosaicBuilder
Builder for creating mosaic layouts with a fluent API
MosaicLayout
Main layout structure using HashMap for O(1) operations

Enums§

DropZone
Drop zone position when hovering over a tile
MosaicNode
Tree representation for external API
SplitDirection
Direction of a split

Functions§

DragGhost
Drag ghost component that follows the cursor
Mosaic
Main mosaic component
SplitPane
A resizable split pane component
TilePane
Wrapper for a tile with controls (split, close, drag-drop)
tile
Create a tile node (helper function)

Type Aliases§

NodeId
Unique identifier for a node in the mosaic layout
TileId
Unique identifier for a tile (user-defined content panel)