hydroxy

Master detail

A list beside its detail. Wide screens show both; narrow ones show one pane at a time with a Back button that returns focus to the row you left. The host owns the selection, so routing stays yours.

Inbox

Launch checklist

Everything on the list is done except the changelog. I will have it by Thursday.

Usage

use hydroxy_leptos::master_detail::{MasterDetail, MasterDetailRow};
use leptos::prelude::*;

const MESSAGES: [(&str, &str, &str); 5] = [
    ("m1", "Launch checklist", "Everything on the list is done except the changelog. I will have it by Thursday."),
    ("m2", "Invoice 4021", "The invoice was sent on the 3rd and is due in two weeks. No reminders have gone out yet."),
    ("m3", "Standup notes", "Ana is blocked on the audio bug. Ben is picking up the transcript work next."),
    ("m4", "Design review", "The new player looks right. Spacing on the rate button needs another pass."),
    ("m5", "Welcome aboard", "Glad to have you. Your laptop ships Monday and your first week is planned."),
];

pub fn demo() -> AnyView {
    // The host owns the selection. Resize below 640px wide to see one pane at a time.
    let (selected, set_selected) = signal(Some("m1".to_string()));

    view! {
        <div style="max-width: 720px; height: 320px; display: grid;">
            <MasterDetail
                selected=selected
                on_select=move |id| set_selected.set(id)
                list_heading=move || "Inbox"
                list=move || {
                    MESSAGES
                        .iter()
                        .map(|(id, title, _)| {
                            view! { <MasterDetailRow id=*id><strong>{*title}</strong></MasterDetailRow> }
                        })
                        .collect_view()
                }
                detail=move || {
                    view! {
                        {move || {
                            let current = selected.get();
                            MESSAGES
                                .iter()
                                .find(|(id, _, _)| Some(*id) == current.as_deref())
                                .map_or_else(
                                    || view! { <p style="margin: 0; color: var(--text-2);">"Choose a message."</p> }.into_any(),
                                    |(_, title, body)| {
                                    view! {
                                        <h3 style="margin: 0 0 var(--space-3); font: var(--text-h3);">{*title}</h3>
                                        <p style="margin: 0; color: var(--text-2);">{*body}</p>
                                    }
                                        .into_any()
                                    },
                                )
                        }}
                    }
                }
            />
        </div>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
MasterDetailrootdata-mobile-pane is list or detail
(inside)listThe list pane
(inside)list-headingOptional h2. Takes focus when the row you left no longer exists
MasterDetailRowrowA button per item. data-selected and aria-current mark the chosen one
(inside)detailThe detail pane. Stays mounted
(inside)backShown on narrow screens only

Keyboard

KeyDoes
Enter / SpaceOn a row: choose it
TabMoves through rows. After Back, focus returns to the row you left

Props

PropTypeNotes
selectedOption<String>The host's selected row id
list / detailViewFnThe two panes. Put MasterDetailRow elements in the list
list_headingOption<ViewFn>A heading for the list
mobile_panePaneModeAuto follows the selection; List or Detail is host-controlled
on_selectCallback<Option<String>>A row was chosen (Some) or Back was pressed (None)
on_pane_changeCallback<Pane>The host should show this pane (explicit modes only)
on_backCallback<String>Back was pressed on this row. Route here
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