hydroxy

Spreadsheet grid

An editable sheet with A1 columns and row numbers. Select ranges with the pointer or Shift, type numbers, text or formulas (=SUM(D2:D9), =A1*1.2), copy and paste as tab-separated text, and resize columns. Only the rows in view are rendered, so 10,000 rows scroll smoothly.

A1
Date
A
B
C
D
E
F
G
H
1
Date
Category
Vendor
Amount
VAT
Summary
2
2026-01-02
Software
Muji
91.69
18.338
Total with VAT
5545124.9999999953
3
2026-01-03
Meals
Dishoom
170.88
34.176
Average claim
462.1399639964
4
2026-01-04
Training
Eurostar
250.07
50.014
Largest
911.77
5
2026-01-05
Office
O'Reilly
329.26
65.852
Smallest
12.54
6
2026-01-06
Travel
Figma
408.45
81.69
VAT owed
924187.5
7
2026-01-07
Meals
Linear
487.64
97.528
8
2026-01-08
Hardware
O'Reilly
566.83
113.366
9
2026-01-09
Training
Figma
646.02
129.204
10
2026-01-10
Travel
Linear
725.21
145.042
11
2026-01-11
Software
Framework
804.40
160.88
12
2026-01-12
Meals
Northwind Rail
883.59
176.718
13
2026-01-13
Training
Muji
62.78
12.556
14
2026-01-14
Office
Dishoom
141.97
28.394
15
2026-01-15
Travel
Northwind Rail
221.16
44.232
16
2026-01-16
Meals
Muji
300.35
60.07
17
2026-01-17
Hardware
Dishoom
379.54
75.908
18
2026-01-18
Training
Eurostar
458.73
91.746
19
2026-01-19
Travel
O'Reilly
537.92
107.584
20
2026-01-20
Software
Figma
617.11
123.422
21
2026-01-21
Meals
Linear
696.30
139.26

Type into a cell, or select a range and paste from a spreadsheet.

Usage

use std::collections::BTreeMap;

use hydroxy_leptos::spreadsheet_grid::{Cell, CellChange, SpreadsheetGrid, cell_name, cells_from_a1};
use leptos::prelude::*;

const ROWS: usize = 10_000;
const CATEGORIES: [&str; 6] = ["Travel", "Software", "Meals", "Hardware", "Training", "Office"];
const VENDORS: [&str; 8] =
    ["Northwind Rail", "Figma", "Dishoom", "Framework", "O'Reilly", "Muji", "Linear", "Eurostar"];

/// A year of expense claims: 9,999 rows, VAT as a formula on each, and totals that read every row.
fn ledger() -> BTreeMap<Cell, String> {
    let mut cells = cells_from_a1(&[
        ("A1", "Date"),
        ("B1", "Category"),
        ("C1", "Vendor"),
        ("D1", "Amount"),
        ("E1", "VAT"),
        ("G1", "Summary"),
        ("G2", "Total with VAT"),
        ("H2", "=SUM(D2:E10000)"),
        ("G3", "Average claim"),
        ("H3", "=AVERAGE(D2:D10000)"),
        ("G4", "Largest"),
        ("H4", "=MAX(D2:D10000)"),
        ("G5", "Smallest"),
        ("H5", "=MIN(D2:D10000)"),
        ("G6", "VAT owed"),
        ("H6", "=SUM(E2:E10000)"),
    ]);
    for row in 1..ROWS {
        let cents = (row * 7919) % 90_000 + 1_250;
        cells.insert((row, 0), format!("2026-{:02}-{:02}", (row / 28) % 12 + 1, row % 28 + 1));
        cells.insert((row, 1), CATEGORIES[(row * 7 + row / 3) % 6].to_string());
        cells.insert((row, 2), VENDORS[(row * 5 + row / 7) % 8].to_string());
        cells.insert((row, 3), format!("{}.{:02}", cents / 100, cents % 100));
        cells.insert((row, 4), format!("=D{}*0.2", row + 1));
    }
    cells
}

pub fn demo() -> AnyView {
    let (last, set_last) = signal(String::from("Type into a cell, or select a range and paste from a spreadsheet."));
    let on_change = move |changes: Vec<CellChange>| {
        let text = match changes.as_slice() {
            [one] => format!(
                "{}: {} → {}",
                cell_name((one.row, one.col)),
                if one.previous.is_empty() { "empty" } else { one.previous.as_str() },
                if one.value.is_empty() { "empty" } else { one.value.as_str() },
            ),
            many => format!("{} cells changed", many.len()),
        };
        set_last.set(text);
    };

    view! {
        <div style="display: grid; gap: var(--space-3);">
            <SpreadsheetGrid
                label="Expense claims"
                rows=ROWS
                cols=8
                default_cells=ledger()
                col_width=120.0
                height=420.0
                on_change=on_change
            />
            <p style="margin: 0; font: var(--text-label); color: var(--text-3);">{last}</p>
        </div>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
SpreadsheetGridrootFormula bar over the viewport, plus the live status
formula-bar, name-box, formulaThe selection's name (B3 or A1:C4) and the active cell's raw text, formula included
viewportrole=grid, the one tab stop. aria-activedescendant names the active cell; aria-multiselectable. Height from the height prop
header-row, corner, column-headerSticky A, B, C header. data-selected on columns in the selection
resize-handlerole=separator on each column's right edge. Drag, or arrow keys when focused
body, row, row-headerRows are absolutely placed at 28px each; only those in view are rendered. Row numbers are sticky
cellrole=gridcell with aria-selected. data-kind: number, text, error or empty. data-active, data-editing
selectionOne outline around the selected range. data-range when it spans more than one cell
editorText input over the cell being edited
statusPolite live region: range size, formula results, pastes and clears

Keyboard

KeyDoes
Arrow keysMove the active cell
Shift + arrow keysExtend the selection
Ctrl + arrow keysJump to the sheet's edge
Home / EndFirst or last column of the row; with Ctrl, A1 or the last cell
PageUp / PageDownMove one screen
Enter / F2Edit the active cell
Any characterStart editing, replacing the cell
Enter / Shift + Enter (editing)Save and move down or up
Tab / Shift + Tab (editing)Save and move right or left
EscapeEditing: discard. Otherwise: shrink the selection to the active cell
Delete / BackspaceClear the selected cells
Ctrl + ASelect every cell
Ctrl + C / X / VCopy, cut or paste the selection as tab-separated text
Left / Right (resize handle)Narrow or widen the column by 8px, 32px with Shift

Props

PropTypeNotes
labelStringRequired. The grid's accessible name
rows / colsusizeSheet size. Defaults 1000 and 10
default_cellsBTreeMap<Cell, String>Initial text by (row, column). cells_from_a1(&[("B2", "=A1*2")]) builds one from A1 names
col_widthf64Initial column width in pixels. Default 112
heightf64Viewport height in pixels. Default 360
on_changeCallback<Vec<CellChange>>Each edit, paste, cut or clear, with row, col, previous and new text
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