Skip to content

Commit 4f6c122

Browse files
committed
Merge branch 'next' of https://github.com/DHTMLX/docs-spreadsheet into next
2 parents 613d1f1 + 327705d commit 4f6c122

7 files changed

Lines changed: 47 additions & 7 deletions

File tree

docs/react/installation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
sidebar_label: Installation
3-
title: Installing React Spreadsheet
3+
title: React Spreadsheet installation
44
description: "How to install the evaluation or commercial version of DHTMLX React Spreadsheet via npm."
55
---
66

7-
# Installing React Spreadsheet
7+
# React Spreadsheet installation
8+
9+
React Spreadsheet is distributed as an npm package in three variants: a public evaluation build, a private evaluation build, and the commercial release. This page covers how to install each variant, import the required CSS stylesheet, and set up TypeScript support.
810

911
:::info Prerequisites
1012
- [Node.js](https://nodejs.org/en/) (LTS version recommended)

docs/react/nextjs.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ description: "How to use DHTMLX React Spreadsheet in a Next.js application with
66

77
# React Spreadsheet in Next.js
88

9-
## Overview
10-
119
DHTMLX Spreadsheet is a client-side widget that requires access to the browser DOM. In Next.js with the App Router, server components are the default, so the spreadsheet must be wrapped in a client component using the `"use client"` directive.
1210

1311
:::note

docs/react/overview.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ The React wrapper provides access to the full feature set of DHTMLX Spreadsheet:
4343

4444
## Quick start
4545

46+
A minimal working example showing how to render a spreadsheet with one sheet and formatted cells.
47+
4648
~~~tsx
4749
import { useState } from "react";
4850
import { ReactSpreadsheet, type SheetData } from "@dhtmlx/trial-react-spreadsheet";
@@ -105,6 +107,8 @@ Props are categorized by how the component handles changes:
105107

106108
### Multi-sheet with formulas
107109

110+
Two sheets with cell values and a `SUM` formula, rendered with sheet tabs enabled.
111+
108112
~~~tsx
109113
const [sheets] = useState<SheetData[]>([
110114
{
@@ -132,6 +136,8 @@ const [sheets] = useState<SheetData[]>([
132136

133137
### Custom toolbar
134138

139+
Pass an array of block identifiers to `toolbarBlocks` to show only the toolbar sections you need.
140+
135141
~~~tsx
136142
<ReactSpreadsheet
137143
sheets={sheets}
@@ -141,6 +147,8 @@ const [sheets] = useState<SheetData[]>([
141147

142148
### Read-only with locked cells
143149

150+
Set `readonly={true}` to disable all editing at the widget level. Adding `locked: true` on cells protects them individually when the spreadsheet is not in read-only mode.
151+
144152
~~~tsx
145153
const sheets: SheetData[] = [
146154
{
@@ -160,6 +168,8 @@ const sheets: SheetData[] = [
160168

161169
## Imperative access via ref
162170

171+
Use a `SpreadsheetRef` to access the underlying widget instance for operations that don't map to declarative props, such as serializing data, triggering undo/redo, or setting the selection programmatically.
172+
163173
~~~tsx
164174
import { useRef } from "react";
165175
import { ReactSpreadsheet, type SpreadsheetRef } from "@dhtmlx/trial-react-spreadsheet";

docs/react/props.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ These props are applied immediately without destroying the widget. No data loss
4444

4545
## Data props
4646

47+
The `sheets` prop is the single source of truth for all spreadsheet content. Changes are applied incrementally: only modified cells, ranges, or settings are updated in the widget.
48+
4749
| Prop | Type | Description |
4850
|------|------|-------------|
4951
| `sheets` | [`SheetData[]`](/react/types#sheetdata) | The single source of truth for all spreadsheet data. Each entry represents a sheet with its cells, structure, and metadata. Changes are applied incrementally. |
@@ -56,25 +58,33 @@ Changing `styles` triggers a full data reload. Spreadsheet data is preserved, bu
5658

5759
## Search props
5860

61+
Controls the search bar state from outside the component. Use it together with `onSearchResults` to build a custom search UI.
62+
5963
| Prop | Type | Description |
6064
|------|------|-------------|
6165
| `search` | [`SearchConfig`](/react/types#searchconfig) | Controlled search state. Pass a `SearchConfig` object to trigger/update search. Pass `undefined` to dismiss the search bar. |
6266

6367
## Data loading props
6468

69+
Load spreadsheet data from a remote URL instead of supplying it through the `sheets` prop.
70+
6571
| Prop | Type | Description |
6672
|------|------|-------------|
6773
| `loadUrl` | `string` | URL to load spreadsheet data from. If both `loadUrl` and `sheets` are provided, `sheets` takes precedence. |
6874
| `loadFormat` | `FileFormat` | File format hint for `loadUrl`. Default: `"json"`. |
6975

7076
## Theme prop
7177

78+
Controls the visual theme applied to the spreadsheet. Since `theme` is a runtime prop, the widget updates immediately when the value changes.
79+
7280
| Prop | Type | Description |
7381
|------|------|-------------|
7482
| `theme` | [`SpreadsheetTheme`](/react/types#spreadsheettheme) | Color theme. Built-in values: `"light"`, `"dark"`, `"contrast-light"`, `"contrast-dark"`. Also accepts custom theme name strings. See [Themes](/react/themes/). |
7583

7684
## Container props
7785

86+
Standard React DOM props applied to the wrapper `<div>` that contains the spreadsheet. Use them to control sizing and layout.
87+
7888
| Prop | Type | Description |
7989
|------|------|-------------|
8090
| `className` | `string` | CSS class name appended to the wrapper `<div>`. |
@@ -86,6 +96,8 @@ Changing `styles` triggers a full data reload. Spreadsheet data is preserved, bu
8696

8797
### Sheets with cell data
8898

99+
A full `SheetData` example with cells, row and column sizing, merged ranges, and a frozen header row.
100+
89101
~~~tsx
90102
const [sheets, setSheets] = useState<SheetData[]>([
91103
{
@@ -113,6 +125,8 @@ const [sheets, setSheets] = useState<SheetData[]>([
113125

114126
### Styles example
115127

128+
Define named styles as CSS property maps in the `styles` prop, then reference them by name via `CellData.css`.
129+
116130
~~~tsx
117131
const styles = {
118132
header: {
@@ -140,12 +154,12 @@ const styles = {
140154

141155
### Multi-sheet mode
142156

157+
Enable sheet tabs with `multiSheets={true}`. Pass `false` to hide the tab bar entirely.
158+
143159
~~~tsx
144160
<ReactSpreadsheet sheets={sheets} multiSheets={true} />
145161
~~~
146162

147-
To disable sheet tabs:
148-
149163
~~~tsx
150164
<ReactSpreadsheet sheets={sheets} multiSheets={false} />
151165
~~~
@@ -175,6 +189,8 @@ To disable sheet tabs:
175189

176190
### Controlled search
177191

192+
Pass a `SearchConfig` object to open the search bar programmatically. Use `onSearchResults` to receive the matching cell references.
193+
178194
~~~tsx
179195
const [search, setSearch] = useState<SearchConfig | undefined>();
180196
const [results, setResults] = useState<string[]>([]);
@@ -219,6 +235,8 @@ const [theme, setTheme] = useState<SpreadsheetTheme>("light");
219235

220236
### Locked cells
221237

238+
Mark individual cells as non-editable with `locked: true`. Unlike `readonly`, this protects specific cells while leaving the rest of the sheet editable.
239+
222240
~~~tsx
223241
const sheets: SheetData[] = [
224242
{
@@ -236,6 +254,8 @@ const sheets: SheetData[] = [
236254

237255
### Cell validation
238256

257+
Pass an array of strings to `CellData.validation` to restrict the cell to a dropdown of allowed values.
258+
239259
~~~tsx
240260
const sheets: SheetData[] = [
241261
{

docs/react/state/redux-toolkit.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ npm install @dhtmlx/trial-react-spreadsheet @reduxjs/toolkit react-redux
2525

2626
## Create the slice
2727

28+
Define the spreadsheet state shape, initial data, and reducers in a Redux Toolkit slice.
29+
2830
~~~ts title="src/store/spreadsheetSlice.ts"
2931
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
3032
import type { SheetData } from "@dhtmlx/trial-react-spreadsheet";
@@ -79,6 +81,8 @@ export default spreadsheetSlice.reducer;
7981

8082
## Configure the store
8183

84+
Register the slice in the Redux store and export the typed `RootState` and `AppDispatch` helpers.
85+
8286
~~~ts title="src/store/index.ts"
8387
import { configureStore } from "@reduxjs/toolkit";
8488
import spreadsheetReducer from "./spreadsheetSlice";
@@ -114,6 +118,8 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
114118

115119
## Create the component
116120

121+
Connect `ReactSpreadsheet` to the Redux store using `useSelector` for reading state and `useDispatch` to sync changes back after each user action.
122+
117123
~~~tsx title="src/App.tsx"
118124
import { useRef } from "react";
119125
import { useSelector, useDispatch } from "react-redux";

docs/react/themes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ description: "Apply built-in or custom themes to DHTMLX React Spreadsheet."
66

77
# React Spreadsheet themes
88

9+
React Spreadsheet ships with four built-in themes and supports custom themes through CSS variables. Use the `theme` prop to select a built-in theme or apply one you have defined yourself.
10+
911
## Built-in themes
1012

1113
The [`SpreadsheetTheme`](/react/types#spreadsheettheme) type defines four built-in themes:
@@ -19,7 +21,7 @@ You can also pass a custom theme name as a string.
1921

2022
## Applying a theme
2123

22-
Pass the `theme` prop to `ReactSpreadsheet`:
24+
Pass the `theme` prop to `ReactSpreadsheet` with the name of the theme you want to use:
2325

2426
~~~tsx
2527
<ReactSpreadsheet sheets={sheets} theme="dark" />

docs/react/types.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ Known spreadsheet action identifiers. Used in [`onBeforeAction`](/react/events/#
227227

228228
## Handler type aliases
229229

230+
Convenience aliases for the function signatures used by event callback props. Import them to annotate your handler functions explicitly.
231+
230232
<div className="overflow-table">
231233

232234
| Type | Signature | Used by |

0 commit comments

Comments
 (0)