hydroxy

Dock layout

An IDE-style workspace: resizable splits whose panes are tab groups. Drag tabs to reorder them or move them between groups, or use the keyboard.

Left and Right arrows switch tabs. Alt with Left or Right reorders the tab. Alt with Up or Down sends it to another group. Delete closes it.

src/ main.rs lib.rs Cargo.toml

fn main() { println!("hello"); }

$ cargo test Compiling demo v0.1.0 Finished test

Nothing closed yet.

Usage

use hydroxy_leptos::dock_layout::{DockLayout, DockPanel, Node, SplitAxis};
use leptos::prelude::*;

fn text(body: &'static str) -> impl IntoView {
    view! { <p style="margin: 0; font: var(--text-sm); color: var(--text-2); white-space: pre-line;">{body}</p> }
}

pub fn demo() -> AnyView {
    let (closed, set_closed) = signal(String::from("Nothing closed yet."));

    view! {
        <div style="display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr);">
            <div style="height: 380px;">
                <DockLayout
                    panels=vec![
                        DockPanel::new("explorer", "Explorer", || text("src/\n  main.rs\n  lib.rs\nCargo.toml")),
                        DockPanel::new("search", "Search", || text("No results.")),
                        DockPanel::new("main", "main.rs", || text("fn main() {\n    println!(\"hello\");\n}")),
                        DockPanel::new("lib", "lib.rs", || text("pub fn add(a: i32, b: i32) -> i32 {\n    a + b\n}")),
                        DockPanel::new("cargo", "Cargo.toml", || text("[package]\nname = \"demo\"")),
                        DockPanel::new("terminal", "Terminal", || text("$ cargo test\n   Compiling demo v0.1.0\n    Finished test")),
                        DockPanel::new("output", "Output", || text("Build finished in 1.2s.")),
                    ]
                    locked=vec!["explorer".to_string()]
                    default_tree=Node::split(
                        "root",
                        SplitAxis::Horizontal,
                        vec![
                            Node::tabs("side", &["explorer", "search"]),
                            Node::split(
                                "work",
                                SplitAxis::Vertical,
                                vec![
                                    Node::tabs("editor", &["main", "lib", "cargo"]),
                                    Node::tabs("bottom", &["terminal", "output"]),
                                ],
                            ),
                        ],
                    )
                    on_close=move |id: String| set_closed.set(format!("Closed {id}."))
                />
            </div>
            <p style="margin: 0; font: var(--text-label); color: var(--text-3);">{closed}</p>
        </div>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
DockLayoutrootFills its parent: give the parent a height
splitWraps a ResizablePanels row or column of children
groupOne pane: a tab strip over its panels. data-empty when it has none
tablistrole=tablist. data-drop-end when a drag would land after the last tab
tabrole=tab, draggable. data-state=active|inactive, data-dragging, data-drop-before
closeButton inside a tab. Absent for locked panels
panelrole=tabpanel. All of a group's panels stay mounted; only the shown one is visible
instructionsVisually hidden keyboard help, linked from every tab by aria-describedby
liverole=status region that announces keyboard moves

Keyboard

KeyDoes
ArrowLeft / ArrowRightShow the previous or next tab in the group
Home / EndShow the first or last tab
Alt + ArrowLeft / ArrowRightMove the tab earlier or later in its group
Alt + ArrowUp / ArrowDownSend the tab to the previous or next group
Delete / BackspaceClose the tab, unless its panel is locked

Props

PropTypeNotes
panelsVec<DockPanel>Required. DockPanel::new(id, title, content). Every id the tree names
default_treeNodeRequired. Node::split(id, axis, children) and Node::tabs(id, &[panel ids])
treeOption<Node>Controlled tree. Pair with on_layout_change
lockedVec<String>Panels that cannot be closed
on_layout_changeCallback<Node>Called with the whole tree when tabs move, close or change
on_closeCallback<String>Called with a panel's id when it closes
Actions
Button
Icon button
Toolbar
Theme menu
Display
Avatar
Badge
Card
Chip
Code block
Markdown
Doc card
Due pill
Kbd
Priority mark
Source chip
Space icon
Status diamond
Tag
Value diff
Carousel
Reveal
Media timeline
QR code
Transcript viewer
Audio waveform
Audio player
Forms
Calendar
Checkbox
Combobox
Date picker
Color picker
Cron builder
Theme editor
Mention input
Signature pad
Image cropper
Date field
Date range picker
Duration field
Quantity stepper
Filter chip
Input
Markdown editor
Radio group
Search field
Segmented control
Select
Slider
Range slider
Rating
Toggle button
File dropzone
Upload queue
Attachment
Switch
Tags input
Number field
Money field
Phone field
Time field
OTP input
Password field
Questionnaire
Availability picker
Voice input
Recording control
Inline edit
Async validated input
Shortcut recorder
Data
Spreadsheet grid
Week scheduler
Virtual list
Stat card
Step track
Kanban board
Sortable list
Filter builder
Data table
Grid
Access editor
File manager
Gantt chart
Log stream
Diff viewer
JSON inspector
Terminal
Node editor
Whiteboard
Navigation
Table of contents
Breadcrumb
Tabs
Wizard
Nav item
Nav section
Tree view
Pagination
Menubar
Navigation menu
Saved views
Layout
Master detail
App shell
Sidebar layout
Resizable panels
Dashboard layout
Dock layout
Feedback
Callout
Check list
Empty state
Progress bar
Toast
Approval card
Skeleton
Notification center
Bars
Bar chart
Diverging bar chart
Span chart
Pictogram chart
Stacked bar chart
Funnel chart
Bullet chart
Waffle chart
Marimekko chart
Dot plot chart
Error bar chart
Pareto chart
Waterfall chart
Lollipop chart
Grouped bar chart
Bar race chart
KPIs and frames
Chart frame
Metric card
Sparkline
Points
Scatter chart
Smith chart
Strip plot
Beeswarm chart
Parallel coordinates
Ternary chart
Bland-Altman chart
Quiver chart
Connected scatter chart
Grids and tables
Heatmap chart
Chart table
Cohort chart
Radial
Radial charts
Radar chart
Polar area chart
Stat ring
Clock chart
Spiral chart
Lines and areas
Bump chart
Slope chart
Line chart
Composed chart
Small multiples
Cycle plot chart
Horizon chart
Stacked area chart
Threshold chart
Split line chart
Linked charts
Confidence band chart
Forecast fan chart
Step chart
Range area chart
Distributions
Contour chart
Histogram
Box plot
Density chart
Ridgeline chart
Violin chart
Q-Q chart
Survival chart
ECDF chart
Raincloud plot
Forest plot
Maps
Geo map
Bubble map
Hexbin map
Cartogram
Flow map
Parts of a whole
Donut chart
Voronoi treemap
Nested donut chart
Treemap chart
Sunburst chart
Bubble pack chart
Icicle chart
Flame graph chart
Pie chart
Word cloud
Relationships
Sankey chart
Network chart
Chord chart
UpSet chart
Venn chart
Alluvial chart
Adjacency matrix chart
Dependency graph chart
Tree chart
Arc diagram
Hive plot
Edge bundling
Finance
Candlestick chart
OHLC chart
Depth chart
Renko chart
Time
Timeline chart
Calendar heatmap chart
Spectrogram chart
Marey chart
Overlays
Tour
Lightbox
Alert dialog
Command palette
Dialog
Menu
Popover
Tooltip
Sheet
Hover card
Context menu
Utilities
Pacer
Hotkeys
Disclosure
Accordion
Collapsible
Chat
Chat bubble
Voice session
Composer
Thread
Thread list
Assistant composer
Assistant MCP
Assistant modal
Assistant thread
Assistant thread list
Message scroller
Insight note
Emoji picker
Tool trace
Model picker
Citation popover
Activity
Activity feed
Comment thread
Timeline
Presence bar
Live cursors
Reaction bar
Guides
Getting started
All components
All charts