react-resizable-panels 4.21.0 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1004 -432
- package/dist/react-resizable-panels.cjs +2 -1
- package/dist/react-resizable-panels.cjs.map +1 -1
- package/dist/react-resizable-panels.d.ts +354 -7
- package/dist/react-resizable-panels.js +4752 -4089
- package/dist/react-resizable-panels.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,9 +29,371 @@ Frequently asked questions can be found [here](https://react-resizable-panels.ve
|
|
|
29
29
|
|
|
30
30
|
Documentation for this project is available at [react-resizable-panels.vercel.app](https://react-resizable-panels.vercel.app/).
|
|
31
31
|
|
|
32
|
+
<!-- react-lib-tools:api:begin -->
|
|
33
|
+
|
|
34
|
+
## Components
|
|
35
|
+
|
|
36
|
+
### Cell
|
|
37
|
+
|
|
38
|
+
A Cell occupies one or more tracks (columns and rows) within a Grid.
|
|
39
|
+
Cells are resized along with the tracks they occupy.
|
|
40
|
+
|
|
41
|
+
Cell elements always include the following attributes:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div data-cell data-testid="cell-id-prop" id="cell-id-prop">
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
48
|
+
|
|
49
|
+
⚠️ Cell elements must be direct DOM children of their parent Grid elements.
|
|
50
|
+
|
|
51
|
+
#### Required props
|
|
52
|
+
|
|
53
|
+
<table>
|
|
54
|
+
<thead>
|
|
55
|
+
<tr>
|
|
56
|
+
<th>Name</th>
|
|
57
|
+
<th>Description</th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>column</td>
|
|
63
|
+
<td><p>Index of the (first) column this cell occupies.</p>
|
|
64
|
+
</td>
|
|
65
|
+
</tr>
|
|
66
|
+
<tr>
|
|
67
|
+
<td>row</td>
|
|
68
|
+
<td><p>Index of the (first) row this cell occupies.</p>
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</tbody>
|
|
72
|
+
</table>
|
|
73
|
+
|
|
74
|
+
#### Optional props
|
|
75
|
+
|
|
76
|
+
<table>
|
|
77
|
+
<thead>
|
|
78
|
+
<tr>
|
|
79
|
+
<th>Name</th>
|
|
80
|
+
<th>Description</th>
|
|
81
|
+
</tr>
|
|
82
|
+
</thead>
|
|
83
|
+
<tbody>
|
|
84
|
+
<tr>
|
|
85
|
+
<td>className</td>
|
|
86
|
+
<td><p>CSS class name.</p>
|
|
87
|
+
</td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>id</td>
|
|
91
|
+
<td><p>Uniquely identifies this cell within the parent grid.
|
|
92
|
+
Falls back to <code>useId</code> when not provided.</p>
|
|
93
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
94
|
+
</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td>style</td>
|
|
98
|
+
<td><p>CSS properties.</p>
|
|
99
|
+
<p>⚠️ Grid placement properties are managed by the Cell and cannot be overridden.</p>
|
|
100
|
+
</td>
|
|
101
|
+
</tr>
|
|
102
|
+
<tr>
|
|
103
|
+
<td>children</td>
|
|
104
|
+
<td><p>Cell contents.</p>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<tr>
|
|
108
|
+
<td>columnSpan</td>
|
|
109
|
+
<td><p>Number of columns this cell spans; defaults to 1.</p>
|
|
110
|
+
</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>elementRef</td>
|
|
114
|
+
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
117
|
+
<tr>
|
|
118
|
+
<td>rowSpan</td>
|
|
119
|
+
<td><p>Number of rows this cell spans; defaults to 1.</p>
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|
|
124
|
+
|
|
125
|
+
### Grid
|
|
126
|
+
|
|
127
|
+
A Grid arranges resizable Cells in two dimensions.
|
|
128
|
+
Columns can be resized horizontally and rows can be resized vertically;
|
|
129
|
+
dragging the point where a column boundary and a row boundary intersect resizes both.
|
|
130
|
+
|
|
131
|
+
Size constraints (e.g. min/max size, collapsible) are specified per track (column or row),
|
|
132
|
+
using the same format as Panel props.
|
|
133
|
+
|
|
134
|
+
Cells can span multiple columns and/or rows.
|
|
135
|
+
Track boundaries cannot be resized alongside of a cell that spans across them.
|
|
136
|
+
|
|
137
|
+
Grid elements always include the following attributes:
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<div data-grid data-testid="grid-id-prop" id="grid-id-prop">
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
144
|
+
|
|
145
|
+
#### Required props
|
|
146
|
+
|
|
147
|
+
<table>
|
|
148
|
+
<thead>
|
|
149
|
+
<tr>
|
|
150
|
+
<th>Name</th>
|
|
151
|
+
<th>Description</th>
|
|
152
|
+
</tr>
|
|
153
|
+
</thead>
|
|
154
|
+
<tbody>
|
|
155
|
+
<tr>
|
|
156
|
+
<td>columns</td>
|
|
157
|
+
<td><p>Grid columns; either the number of columns or an array of size constraints (one per column).</p>
|
|
158
|
+
</td>
|
|
159
|
+
</tr>
|
|
160
|
+
<tr>
|
|
161
|
+
<td>rows</td>
|
|
162
|
+
<td><p>Grid rows; either the number of rows or an array of size constraints (one per row).</p>
|
|
163
|
+
</td>
|
|
164
|
+
</tr>
|
|
165
|
+
</tbody>
|
|
166
|
+
</table>
|
|
167
|
+
|
|
168
|
+
#### Optional props
|
|
169
|
+
|
|
170
|
+
<table>
|
|
171
|
+
<thead>
|
|
172
|
+
<tr>
|
|
173
|
+
<th>Name</th>
|
|
174
|
+
<th>Description</th>
|
|
175
|
+
</tr>
|
|
176
|
+
</thead>
|
|
177
|
+
<tbody>
|
|
178
|
+
<tr>
|
|
179
|
+
<td>className</td>
|
|
180
|
+
<td><p>CSS class name.</p>
|
|
181
|
+
</td>
|
|
182
|
+
</tr>
|
|
183
|
+
<tr>
|
|
184
|
+
<td>id</td>
|
|
185
|
+
<td><p>Uniquely identifies this grid within an application.
|
|
186
|
+
Falls back to <code>useId</code> when not provided.</p>
|
|
187
|
+
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
188
|
+
</td>
|
|
189
|
+
</tr>
|
|
190
|
+
<tr>
|
|
191
|
+
<td>style</td>
|
|
192
|
+
<td><p>CSS properties.</p>
|
|
193
|
+
<p>⚠️ Grid template and display properties are managed by the Grid and cannot be overridden.</p>
|
|
194
|
+
</td>
|
|
195
|
+
</tr>
|
|
196
|
+
<tr>
|
|
197
|
+
<td>children</td>
|
|
198
|
+
<td><p>Cell and Gridline components that comprise this grid.</p>
|
|
199
|
+
<p>⚠️ Cell and Gridline elements must be direct DOM children of their parent Grid element.</p>
|
|
200
|
+
</td>
|
|
201
|
+
</tr>
|
|
202
|
+
<tr>
|
|
203
|
+
<td>defaultLayout</td>
|
|
204
|
+
<td><p>Default layout for either or both of the Grid's axes.</p>
|
|
205
|
+
<p>ℹ️ This value allows layouts to be remembered between page reloads.</p>
|
|
206
|
+
</td>
|
|
207
|
+
</tr>
|
|
208
|
+
<tr>
|
|
209
|
+
<td>disableCursor</td>
|
|
210
|
+
<td><p>This library sets custom mouse cursor styles to indicate drag state.
|
|
211
|
+
Use this prop to disable that behavior for this grid.</p>
|
|
212
|
+
</td>
|
|
213
|
+
</tr>
|
|
214
|
+
<tr>
|
|
215
|
+
<td>disabled</td>
|
|
216
|
+
<td><p>Disable resize functionality.</p>
|
|
217
|
+
</td>
|
|
218
|
+
</tr>
|
|
219
|
+
<tr>
|
|
220
|
+
<td>elementRef</td>
|
|
221
|
+
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
222
|
+
</td>
|
|
223
|
+
</tr>
|
|
224
|
+
<tr>
|
|
225
|
+
<td>gridRef</td>
|
|
226
|
+
<td><p>Exposes the following imperative API:</p>
|
|
227
|
+
<ul>
|
|
228
|
+
<li><code>getLayout(): GridLayout</code></li>
|
|
229
|
+
<li><code>getTrackById(axis: "column" | "row", id: string | number): GridTrackImperativeHandle</code></li>
|
|
230
|
+
<li><code>getTrackByIndex(axis: "column" | "row", index: number): GridTrackImperativeHandle</code></li>
|
|
231
|
+
<li><code>setLayout(layout: Partial<GridLayout>): GridLayout</code></li>
|
|
232
|
+
</ul>
|
|
233
|
+
<p>ℹ️ The <code>useGridRef</code> and <code>useGridCallbackRef</code> hooks are exported for convenience in TypeScript projects.</p>
|
|
234
|
+
</td>
|
|
235
|
+
</tr>
|
|
236
|
+
<tr>
|
|
237
|
+
<td>onLayoutChange</td>
|
|
238
|
+
<td><p>Called when the Grid's layout is changing.</p>
|
|
239
|
+
<p>⚠️ For layout changes caused by pointer events, this method is called each time the pointer is moved.
|
|
240
|
+
For most cases, it is recommended to use the <code>onLayoutChanged</code> callback instead.</p>
|
|
241
|
+
</td>
|
|
242
|
+
</tr>
|
|
243
|
+
<tr>
|
|
244
|
+
<td>onLayoutChanged</td>
|
|
245
|
+
<td><p>Called after the Grid's layout has been changed.</p>
|
|
246
|
+
<p>ℹ️ For layout changes caused by pointer events, this callback is not called until the pointer has been released.
|
|
247
|
+
This callback is recommended for saving layouts to storage.</p>
|
|
248
|
+
</td>
|
|
249
|
+
</tr>
|
|
250
|
+
<tr>
|
|
251
|
+
<td>resizeTargetMinimumSize</td>
|
|
252
|
+
<td><p>Minimum size of the resizable hit target area (either a <code>Gridline</code> or a <code>Cell</code> edge).
|
|
253
|
+
This threshold ensures targets are large enough to avoid mis-clicks.</p>
|
|
254
|
+
<p>ℹ️ Refer to the <code>Group</code> prop of the same name for more information.</p>
|
|
255
|
+
</td>
|
|
256
|
+
</tr>
|
|
257
|
+
</tbody>
|
|
258
|
+
</table>
|
|
259
|
+
|
|
260
|
+
### Gridline
|
|
261
|
+
|
|
262
|
+
Resizes the columns (or rows) of a Grid.
|
|
263
|
+
|
|
264
|
+
For example:
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
// Rendered between columns 0 and 1 and spans all rows
|
|
268
|
+
<Gridline type="column" column={1} />
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
// Rendered between rows 0 and 1 and spans all columns
|
|
273
|
+
<Gridline type="row" row={1} />
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
// Rendered between columns 0 and 1 alongside of row 2 only
|
|
278
|
+
<Gridline type="column" column={1} row={2} rowSpan={1} />
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
A gridline should not be rendered alongside of a Cell that spans across its boundary
|
|
282
|
+
(this includes disabled gridlines; in development builds, an error will be logged to the console);
|
|
283
|
+
render multiple gridlines along the same boundary instead (e.g. before and after the spanning Cell).
|
|
284
|
+
|
|
285
|
+
ℹ️ Once a boundary contains a gridline, it can only be resized using gridlines;
|
|
286
|
+
the parts of the boundary that aren't alongside of a gridline can't be dragged.
|
|
287
|
+
|
|
288
|
+
Where column and row gridlines intersect, dragging resizes both axes.
|
|
289
|
+
|
|
290
|
+
Gridlines are not _required_ but they are _recommended_ as they improve keyboard accessibility.
|
|
291
|
+
|
|
292
|
+
Gridline elements always include the following attributes:
|
|
293
|
+
|
|
294
|
+
```html
|
|
295
|
+
<div aria-orientation="vertical" data-separator role="separator">
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
ℹ️ Column gridlines are vertical (`aria-orientation="vertical"`) and row gridlines are horizontal (`aria-orientation="horizontal"`).
|
|
299
|
+
|
|
300
|
+
ℹ️ In addition to the attributes shown above, gridlines also render all required [WAI-ARIA properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role#associated_wai-aria_roles_states_and_properties).
|
|
301
|
+
|
|
302
|
+
⚠️ Gridline elements must be direct DOM children of their parent Grid elements.
|
|
303
|
+
|
|
304
|
+
ℹ️ Gridlines rendered by another component (rather than directly within the Grid) aren't detected until they mount, so server-rendered layouts may shift slightly during hydration.
|
|
305
|
+
|
|
306
|
+
#### Required props
|
|
307
|
+
|
|
308
|
+
<table>
|
|
309
|
+
<thead>
|
|
310
|
+
<tr>
|
|
311
|
+
<th>Name</th>
|
|
312
|
+
<th>Description</th>
|
|
313
|
+
</tr>
|
|
314
|
+
</thead>
|
|
315
|
+
<tbody>
|
|
316
|
+
<tr>
|
|
317
|
+
<td>type</td>
|
|
318
|
+
<td><p>Column gridlines are vertical; they resize the columns on either side of them.
|
|
319
|
+
Row gridlines are horizontal; they resize the rows on either side of them.</p>
|
|
320
|
+
</td>
|
|
321
|
+
</tr>
|
|
322
|
+
</tbody>
|
|
323
|
+
</table>
|
|
324
|
+
|
|
325
|
+
#### Optional props
|
|
326
|
+
|
|
327
|
+
<table>
|
|
328
|
+
<thead>
|
|
329
|
+
<tr>
|
|
330
|
+
<th>Name</th>
|
|
331
|
+
<th>Description</th>
|
|
332
|
+
</tr>
|
|
333
|
+
</thead>
|
|
334
|
+
<tbody>
|
|
335
|
+
<tr>
|
|
336
|
+
<td>children</td>
|
|
337
|
+
<td><p>Gridline contents (e.g. a drag handle icon).</p>
|
|
338
|
+
</td>
|
|
339
|
+
</tr>
|
|
340
|
+
<tr>
|
|
341
|
+
<td>className</td>
|
|
342
|
+
<td><p>CSS class name.</p>
|
|
343
|
+
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
344
|
+
</td>
|
|
345
|
+
</tr>
|
|
346
|
+
<tr>
|
|
347
|
+
<td>disabled</td>
|
|
348
|
+
<td><p>When disabled, the gridline cannot be used to resize its neighboring tracks.</p>
|
|
349
|
+
<p>ℹ️ The tracks may still be resized indirectly (e.g. by an intersecting gridline or another boundary).
|
|
350
|
+
To prevent a track from being resized at all, it needs to also be disabled.</p>
|
|
351
|
+
</td>
|
|
352
|
+
</tr>
|
|
353
|
+
<tr>
|
|
354
|
+
<td>elementRef</td>
|
|
355
|
+
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
356
|
+
</td>
|
|
357
|
+
</tr>
|
|
358
|
+
<tr>
|
|
359
|
+
<td>style</td>
|
|
360
|
+
<td><p>CSS properties.</p>
|
|
361
|
+
<p>⚠️ Grid placement properties are managed by the gridline and cannot be overridden.</p>
|
|
362
|
+
</td>
|
|
363
|
+
</tr>
|
|
364
|
+
<tr>
|
|
365
|
+
<td>column</td>
|
|
366
|
+
<td><p>When <code>type</code> is "column", the gridline is rendered along the leading (left) edge of this column
|
|
367
|
+
(between it and the previous column); must be greater than 0 and less than the number of columns.
|
|
368
|
+
When <code>type</code> is "row", index of the first column the gridline is rendered alongside of; defaults to 0.</p>
|
|
369
|
+
</td>
|
|
370
|
+
</tr>
|
|
371
|
+
<tr>
|
|
372
|
+
<td>row</td>
|
|
373
|
+
<td><p>When <code>type</code> is "column", index of the first row the gridline is rendered alongside of; defaults to 0.
|
|
374
|
+
When <code>type</code> is "row", the gridline is rendered along the leading (top) edge of this row
|
|
375
|
+
(between it and the previous row); must be greater than 0 and less than the number of rows.</p>
|
|
376
|
+
</td>
|
|
377
|
+
</tr>
|
|
378
|
+
<tr>
|
|
379
|
+
<td>rowSpan</td>
|
|
380
|
+
<td><p>Number of rows a column gridline spans; defaults to all rows (starting from <code>row</code>).</p>
|
|
381
|
+
<p>ℹ️ Gridlines can span a subset of rows in order to avoid cells that span across the boundary they sit on;
|
|
382
|
+
multiple gridlines can be rendered along the same boundary (e.g. above and below a spanning cell).</p>
|
|
383
|
+
</td>
|
|
384
|
+
</tr>
|
|
385
|
+
<tr>
|
|
386
|
+
<td>columnSpan</td>
|
|
387
|
+
<td><p>Number of columns a row gridline spans; defaults to all columns (starting from <code>column</code>).</p>
|
|
388
|
+
<p>ℹ️ Gridlines can span a subset of columns in order to avoid cells that span across the boundary they sit on;
|
|
389
|
+
multiple gridlines can be rendered along the same boundary (e.g. before and after a spanning cell).</p>
|
|
390
|
+
</td>
|
|
391
|
+
</tr>
|
|
392
|
+
</tbody>
|
|
393
|
+
</table>
|
|
394
|
+
|
|
32
395
|
### Group
|
|
33
396
|
|
|
34
|
-
<!-- Group:description:begin -->
|
|
35
397
|
A Group wraps a set of resizable Panel components.
|
|
36
398
|
Group content can be resized _horizontally_ or _vertically_.
|
|
37
399
|
|
|
@@ -42,18 +404,13 @@ Group elements always include the following attributes:
|
|
|
42
404
|
```
|
|
43
405
|
|
|
44
406
|
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
45
|
-
<!-- Group:description:end -->
|
|
46
407
|
|
|
47
408
|
#### Required props
|
|
48
409
|
|
|
49
|
-
<!-- Group:required-props:begin -->
|
|
50
410
|
None
|
|
51
|
-
<!-- Group:required-props:end -->
|
|
52
411
|
|
|
53
412
|
#### Optional props
|
|
54
413
|
|
|
55
|
-
<!-- Group:optional-props:begin -->
|
|
56
|
-
|
|
57
414
|
<table>
|
|
58
415
|
<thead>
|
|
59
416
|
<tr>
|
|
@@ -168,11 +525,8 @@ In practice this seems to be much larger than many of their own applications use
|
|
|
168
525
|
</tbody>
|
|
169
526
|
</table>
|
|
170
527
|
|
|
171
|
-
<!-- Group:optional-props:end -->
|
|
172
|
-
|
|
173
528
|
### Panel
|
|
174
529
|
|
|
175
|
-
<!-- Panel:description:begin -->
|
|
176
530
|
A Panel wraps resizable content and can be configured with min/max size constraints and collapsible behavior.
|
|
177
531
|
|
|
178
532
|
Panel size props can be in the following formats:
|
|
@@ -196,18 +550,13 @@ Panel elements always include the following attributes:
|
|
|
196
550
|
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
197
551
|
|
|
198
552
|
⚠️ Panel elements must be direct DOM children of their parent Group elements.
|
|
199
|
-
<!-- Panel:description:end -->
|
|
200
553
|
|
|
201
554
|
#### Required props
|
|
202
555
|
|
|
203
|
-
<!-- Panel:required-props:begin -->
|
|
204
556
|
None
|
|
205
|
-
<!-- Panel:required-props:end -->
|
|
206
557
|
|
|
207
558
|
#### Optional props
|
|
208
559
|
|
|
209
|
-
<!-- Panel:optional-props:begin -->
|
|
210
|
-
|
|
211
560
|
<table>
|
|
212
561
|
<thead>
|
|
213
562
|
<tr>
|
|
@@ -311,317 +660,62 @@ Defaults to <code>preserve-relative-size</code>.</p>
|
|
|
311
660
|
<tr>
|
|
312
661
|
<td>minSize</td>
|
|
313
662
|
<td><p>Minimum size of Panel within its parent group; defaults to 0%.</p>
|
|
314
|
-
<p>ℹ️ Interpretation rules:</p>
|
|
315
|
-
<ul>
|
|
316
|
-
<li>Numbers are interpreted as pixels (e.g. <code>minSize={200}</code> is 200 pixels)</li>
|
|
317
|
-
<li>Strings without explicit units are interpreted as percentage (e.g. <code>minSize="50"</code> is 50 percent)</li>
|
|
318
|
-
<li>Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation</li>
|
|
319
|
-
</ul>
|
|
320
|
-
</td>
|
|
321
|
-
</tr>
|
|
322
|
-
<tr>
|
|
323
|
-
<td>onResize</td>
|
|
324
|
-
<td><p>Called when panel sizes change.
|
|
325
|
-
@param panelSize Panel size (both as a percentage of the parent Group and in pixels)
|
|
326
|
-
@param id Panel id (if one was provided as a prop)
|
|
327
|
-
@param prevPanelSize Previous panel size (will be undefined on mount)</p>
|
|
328
|
-
</td>
|
|
329
|
-
</tr>
|
|
330
|
-
<tr>
|
|
331
|
-
<td>panelRef</td>
|
|
332
|
-
<td><p>Exposes the following imperative API:</p>
|
|
333
|
-
<ul>
|
|
334
|
-
<li><code>collapse(): void</code></li>
|
|
335
|
-
<li><code>expand(): void</code></li>
|
|
336
|
-
<li><code>getSize(): PanelSize</code></li>
|
|
337
|
-
<li><code>isCollapsed(): boolean</code></li>
|
|
338
|
-
<li><code>resize(size: number | string): void</code></li>
|
|
339
|
-
</ul>
|
|
340
|
-
<p>ℹ️ The <code>usePanelRef</code> and <code>usePanelCallbackRef</code> hooks are exported for convenience in TypeScript projects.</p>
|
|
341
|
-
</td>
|
|
342
|
-
</tr>
|
|
343
|
-
</tbody>
|
|
344
|
-
</table>
|
|
345
|
-
|
|
346
|
-
<!-- Panel:optional-props:end -->
|
|
347
|
-
|
|
348
|
-
### Separator
|
|
349
|
-
|
|
350
|
-
<!-- Separator:description:begin -->
|
|
351
|
-
Separators are not _required_ but they are _recommended_ as they improve keyboard accessibility.
|
|
352
|
-
|
|
353
|
-
⚠️ Separator elements must be direct DOM children of their parent Group elements.
|
|
354
|
-
|
|
355
|
-
Separator elements always include the following attributes:
|
|
356
|
-
|
|
357
|
-
```html
|
|
358
|
-
<div data-separator data-testid="separator-id-prop" id="separator-id-prop" role="separator">
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
362
|
-
|
|
363
|
-
ℹ️ In addition to the attributes shown above, separator also renders all required [WAI-ARIA properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role#associated_wai-aria_roles_states_and_properties).
|
|
364
|
-
<!-- Separator:description:end -->
|
|
365
|
-
|
|
366
|
-
#### Required props
|
|
367
|
-
|
|
368
|
-
<!-- Separator:required-props:begin -->
|
|
369
|
-
None
|
|
370
|
-
<!-- Separator:required-props:end -->
|
|
371
|
-
|
|
372
|
-
#### Optional props
|
|
373
|
-
|
|
374
|
-
<!-- Separator:optional-props:begin -->
|
|
375
|
-
|
|
376
|
-
<table>
|
|
377
|
-
<thead>
|
|
378
|
-
<tr>
|
|
379
|
-
<th>Name</th>
|
|
380
|
-
<th>Description</th>
|
|
381
|
-
</tr>
|
|
382
|
-
</thead>
|
|
383
|
-
<tbody>
|
|
384
|
-
<tr>
|
|
385
|
-
<td>className</td>
|
|
386
|
-
<td><p>CSS class name.</p>
|
|
387
|
-
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
388
|
-
<p>⚠️ The following properties cannot be overridden: <code>flex-grow</code>, <code>flex-shrink</code></p>
|
|
389
|
-
</td>
|
|
390
|
-
</tr>
|
|
391
|
-
<tr>
|
|
392
|
-
<td>id</td>
|
|
393
|
-
<td><p>Uniquely identifies the separator within the parent group.
|
|
394
|
-
Falls back to <code>useId</code> when not provided.</p>
|
|
395
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
396
|
-
</td>
|
|
397
|
-
</tr>
|
|
398
|
-
<tr>
|
|
399
|
-
<td>style</td>
|
|
400
|
-
<td><p>CSS properties.</p>
|
|
401
|
-
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
402
|
-
<p>⚠️ The following properties cannot be overridden: <code>flex-grow</code>, <code>flex-shrink</code></p>
|
|
403
|
-
</td>
|
|
404
|
-
</tr>
|
|
405
|
-
<tr>
|
|
406
|
-
<td>disabled</td>
|
|
407
|
-
<td><p>When disabled, the separator cannot be used to resize its neighboring panels.</p>
|
|
408
|
-
<p>ℹ️ The panels may still be resized indirectly (while other panels are being resized).
|
|
409
|
-
To prevent a panel from being resized at all, it needs to also be disabled.</p>
|
|
410
|
-
</td>
|
|
411
|
-
</tr>
|
|
412
|
-
<tr>
|
|
413
|
-
<td>disableDoubleClick</td>
|
|
414
|
-
<td><p>When true, double-clicking this <code>Separator</code> will not reset its <code>Panel</code> to its default size.</p>
|
|
415
|
-
</td>
|
|
416
|
-
</tr>
|
|
417
|
-
<tr>
|
|
418
|
-
<td>elementRef</td>
|
|
419
|
-
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
420
|
-
</td>
|
|
421
|
-
</tr>
|
|
422
|
-
<tr>
|
|
423
|
-
<td>preview</td>
|
|
424
|
-
<td><p>Overrides the <code>Group</code> default preview for this <code>Separator</code> when <code>resizePreviewMode</code> is "separator".</p>
|
|
425
|
-
</td>
|
|
426
|
-
</tr>
|
|
427
|
-
</tbody>
|
|
428
|
-
</table>
|
|
429
|
-
|
|
430
|
-
<!-- Separator:optional-props:end -->
|
|
431
|
-
|
|
432
|
-
### Grid
|
|
433
|
-
|
|
434
|
-
<!-- Grid:description:begin -->
|
|
435
|
-
A Grid arranges resizable Cells in two dimensions.
|
|
436
|
-
Columns can be resized horizontally and rows can be resized vertically;
|
|
437
|
-
dragging the point where a column boundary and a row boundary intersect resizes both.
|
|
438
|
-
|
|
439
|
-
Size constraints (e.g. min/max size, collapsible) are specified per track (column or row),
|
|
440
|
-
using the same format as Panel props.
|
|
441
|
-
|
|
442
|
-
Cells can span multiple columns and/or rows.
|
|
443
|
-
Track boundaries cannot be resized alongside of a cell that spans across them.
|
|
444
|
-
|
|
445
|
-
Grid elements always include the following attributes:
|
|
446
|
-
|
|
447
|
-
```html
|
|
448
|
-
<div data-grid data-testid="grid-id-prop" id="grid-id-prop">
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
452
|
-
<!-- Grid:description:end -->
|
|
453
|
-
|
|
454
|
-
#### Required props
|
|
455
|
-
|
|
456
|
-
<!-- Grid:required-props:begin -->
|
|
457
|
-
|
|
458
|
-
<table>
|
|
459
|
-
<thead>
|
|
460
|
-
<tr>
|
|
461
|
-
<th>Name</th>
|
|
462
|
-
<th>Description</th>
|
|
463
|
-
</tr>
|
|
464
|
-
</thead>
|
|
465
|
-
<tbody>
|
|
466
|
-
<tr>
|
|
467
|
-
<td>columns</td>
|
|
468
|
-
<td><p>Grid columns; either the number of columns or an array of size constraints (one per column).</p>
|
|
469
|
-
</td>
|
|
470
|
-
</tr>
|
|
471
|
-
<tr>
|
|
472
|
-
<td>rows</td>
|
|
473
|
-
<td><p>Grid rows; either the number of rows or an array of size constraints (one per row).</p>
|
|
474
|
-
</td>
|
|
475
|
-
</tr>
|
|
476
|
-
</tbody>
|
|
477
|
-
</table>
|
|
478
|
-
|
|
479
|
-
<!-- Grid:required-props:end -->
|
|
480
|
-
|
|
481
|
-
#### Optional props
|
|
482
|
-
|
|
483
|
-
<!-- Grid:optional-props:begin -->
|
|
484
|
-
|
|
485
|
-
<table>
|
|
486
|
-
<thead>
|
|
487
|
-
<tr>
|
|
488
|
-
<th>Name</th>
|
|
489
|
-
<th>Description</th>
|
|
490
|
-
</tr>
|
|
491
|
-
</thead>
|
|
492
|
-
<tbody>
|
|
493
|
-
<tr>
|
|
494
|
-
<td>className</td>
|
|
495
|
-
<td><p>CSS class name.</p>
|
|
496
|
-
</td>
|
|
497
|
-
</tr>
|
|
498
|
-
<tr>
|
|
499
|
-
<td>id</td>
|
|
500
|
-
<td><p>Uniquely identifies this grid within an application.
|
|
501
|
-
Falls back to <code>useId</code> when not provided.</p>
|
|
502
|
-
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
503
|
-
</td>
|
|
504
|
-
</tr>
|
|
505
|
-
<tr>
|
|
506
|
-
<td>style</td>
|
|
507
|
-
<td><p>CSS properties.</p>
|
|
508
|
-
<p>⚠️ Grid template and display properties are managed by the Grid and cannot be overridden.</p>
|
|
509
|
-
</td>
|
|
510
|
-
</tr>
|
|
511
|
-
<tr>
|
|
512
|
-
<td>children</td>
|
|
513
|
-
<td><p>Cell and Gridline components that comprise this grid.</p>
|
|
514
|
-
<p>⚠️ Cell and Gridline elements must be direct DOM children of their parent Grid element.</p>
|
|
515
|
-
</td>
|
|
516
|
-
</tr>
|
|
517
|
-
<tr>
|
|
518
|
-
<td>defaultLayout</td>
|
|
519
|
-
<td><p>Default layout for either or both of the Grid's axes.</p>
|
|
520
|
-
<p>ℹ️ This value allows layouts to be remembered between page reloads.</p>
|
|
521
|
-
</td>
|
|
522
|
-
</tr>
|
|
523
|
-
<tr>
|
|
524
|
-
<td>disableCursor</td>
|
|
525
|
-
<td><p>This library sets custom mouse cursor styles to indicate drag state.
|
|
526
|
-
Use this prop to disable that behavior for this grid.</p>
|
|
527
|
-
</td>
|
|
528
|
-
</tr>
|
|
529
|
-
<tr>
|
|
530
|
-
<td>disabled</td>
|
|
531
|
-
<td><p>Disable resize functionality.</p>
|
|
532
|
-
</td>
|
|
533
|
-
</tr>
|
|
534
|
-
<tr>
|
|
535
|
-
<td>elementRef</td>
|
|
536
|
-
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
537
|
-
</td>
|
|
538
|
-
</tr>
|
|
539
|
-
<tr>
|
|
540
|
-
<td>gridRef</td>
|
|
541
|
-
<td><p>Exposes the following imperative API:</p>
|
|
542
|
-
<ul>
|
|
543
|
-
<li><code>getLayout(): GridLayout</code></li>
|
|
544
|
-
<li><code>getTrackById(axis: "column" | "row", id: string | number): GridTrackImperativeHandle</code></li>
|
|
545
|
-
<li><code>getTrackByIndex(axis: "column" | "row", index: number): GridTrackImperativeHandle</code></li>
|
|
546
|
-
<li><code>setLayout(layout: Partial<GridLayout>): GridLayout</code></li>
|
|
547
|
-
</ul>
|
|
548
|
-
<p>ℹ️ The <code>useGridRef</code> and <code>useGridCallbackRef</code> hooks are exported for convenience in TypeScript projects.</p>
|
|
549
|
-
</td>
|
|
550
|
-
</tr>
|
|
551
|
-
<tr>
|
|
552
|
-
<td>onLayoutChange</td>
|
|
553
|
-
<td><p>Called when the Grid's layout is changing.</p>
|
|
554
|
-
<p>⚠️ For layout changes caused by pointer events, this method is called each time the pointer is moved.
|
|
555
|
-
For most cases, it is recommended to use the <code>onLayoutChanged</code> callback instead.</p>
|
|
663
|
+
<p>ℹ️ Interpretation rules:</p>
|
|
664
|
+
<ul>
|
|
665
|
+
<li>Numbers are interpreted as pixels (e.g. <code>minSize={200}</code> is 200 pixels)</li>
|
|
666
|
+
<li>Strings without explicit units are interpreted as percentage (e.g. <code>minSize="50"</code> is 50 percent)</li>
|
|
667
|
+
<li>Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation</li>
|
|
668
|
+
</ul>
|
|
556
669
|
</td>
|
|
557
670
|
</tr>
|
|
558
671
|
<tr>
|
|
559
|
-
<td>
|
|
560
|
-
<td><p>Called
|
|
561
|
-
<
|
|
562
|
-
|
|
672
|
+
<td>onResize</td>
|
|
673
|
+
<td><p>Called when panel sizes change.</p>
|
|
674
|
+
<ul>
|
|
675
|
+
<li><code>panelSize</code> Panel size (both as a percentage of the parent Group and in pixels)</li>
|
|
676
|
+
<li><code>id</code> Panel id (if one was provided as a prop)</li>
|
|
677
|
+
<li><code>prevPanelSize</code> Previous panel size (will be undefined on mount)</li>
|
|
678
|
+
</ul>
|
|
563
679
|
</td>
|
|
564
680
|
</tr>
|
|
565
681
|
<tr>
|
|
566
|
-
<td>
|
|
567
|
-
<td><p>
|
|
568
|
-
|
|
569
|
-
<
|
|
682
|
+
<td>panelRef</td>
|
|
683
|
+
<td><p>Exposes the following imperative API:</p>
|
|
684
|
+
<ul>
|
|
685
|
+
<li><code>collapse(): void</code></li>
|
|
686
|
+
<li><code>expand(): void</code></li>
|
|
687
|
+
<li><code>getSize(): PanelSize</code></li>
|
|
688
|
+
<li><code>isCollapsed(): boolean</code></li>
|
|
689
|
+
<li><code>resize(size: number | string): void</code></li>
|
|
690
|
+
</ul>
|
|
691
|
+
<p>ℹ️ The <code>usePanelRef</code> and <code>usePanelCallbackRef</code> hooks are exported for convenience in TypeScript projects.</p>
|
|
570
692
|
</td>
|
|
571
693
|
</tr>
|
|
572
694
|
</tbody>
|
|
573
695
|
</table>
|
|
574
696
|
|
|
575
|
-
|
|
697
|
+
### Separator
|
|
576
698
|
|
|
577
|
-
|
|
699
|
+
Separators are not _required_ but they are _recommended_ as they improve keyboard accessibility.
|
|
578
700
|
|
|
579
|
-
|
|
580
|
-
A Cell occupies one or more tracks (columns and rows) within a Grid.
|
|
581
|
-
Cells are resized along with the tracks they occupy.
|
|
701
|
+
⚠️ Separator elements must be direct DOM children of their parent Group elements.
|
|
582
702
|
|
|
583
|
-
|
|
703
|
+
Separator elements always include the following attributes:
|
|
584
704
|
|
|
585
705
|
```html
|
|
586
|
-
<div data-
|
|
706
|
+
<div data-separator data-testid="separator-id-prop" id="separator-id-prop" role="separator">
|
|
587
707
|
```
|
|
588
708
|
|
|
589
709
|
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
590
710
|
|
|
591
|
-
|
|
592
|
-
<!-- Cell:description:end -->
|
|
711
|
+
ℹ️ In addition to the attributes shown above, separator also renders all required [WAI-ARIA properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role#associated_wai-aria_roles_states_and_properties).
|
|
593
712
|
|
|
594
713
|
#### Required props
|
|
595
714
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
<table>
|
|
599
|
-
<thead>
|
|
600
|
-
<tr>
|
|
601
|
-
<th>Name</th>
|
|
602
|
-
<th>Description</th>
|
|
603
|
-
</tr>
|
|
604
|
-
</thead>
|
|
605
|
-
<tbody>
|
|
606
|
-
<tr>
|
|
607
|
-
<td>column</td>
|
|
608
|
-
<td><p>Index of the (first) column this cell occupies.</p>
|
|
609
|
-
</td>
|
|
610
|
-
</tr>
|
|
611
|
-
<tr>
|
|
612
|
-
<td>row</td>
|
|
613
|
-
<td><p>Index of the (first) row this cell occupies.</p>
|
|
614
|
-
</td>
|
|
615
|
-
</tr>
|
|
616
|
-
</tbody>
|
|
617
|
-
</table>
|
|
618
|
-
|
|
619
|
-
<!-- Cell:required-props:end -->
|
|
715
|
+
None
|
|
620
716
|
|
|
621
717
|
#### Optional props
|
|
622
718
|
|
|
623
|
-
<!-- Cell:optional-props:begin -->
|
|
624
|
-
|
|
625
719
|
<table>
|
|
626
720
|
<thead>
|
|
627
721
|
<tr>
|
|
@@ -633,11 +727,13 @@ Cell elements always include the following attributes:
|
|
|
633
727
|
<tr>
|
|
634
728
|
<td>className</td>
|
|
635
729
|
<td><p>CSS class name.</p>
|
|
730
|
+
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
731
|
+
<p>⚠️ The following properties cannot be overridden: <code>flex-grow</code>, <code>flex-shrink</code></p>
|
|
636
732
|
</td>
|
|
637
733
|
</tr>
|
|
638
734
|
<tr>
|
|
639
735
|
<td>id</td>
|
|
640
|
-
<td><p>Uniquely identifies
|
|
736
|
+
<td><p>Uniquely identifies the separator within the parent group.
|
|
641
737
|
Falls back to <code>useId</code> when not provided.</p>
|
|
642
738
|
<p>ℹ️ This value will also be assigned to the <code>id</code> and <code>data-testid</code> attributes (an explicit <code>data-testid</code> prop will take precedence).</p>
|
|
643
739
|
</td>
|
|
@@ -645,17 +741,20 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
645
741
|
<tr>
|
|
646
742
|
<td>style</td>
|
|
647
743
|
<td><p>CSS properties.</p>
|
|
648
|
-
<p
|
|
744
|
+
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
745
|
+
<p>⚠️ The following properties cannot be overridden: <code>flex-grow</code>, <code>flex-shrink</code></p>
|
|
649
746
|
</td>
|
|
650
747
|
</tr>
|
|
651
748
|
<tr>
|
|
652
|
-
<td>
|
|
653
|
-
<td><p>
|
|
749
|
+
<td>disabled</td>
|
|
750
|
+
<td><p>When disabled, the separator cannot be used to resize its neighboring panels.</p>
|
|
751
|
+
<p>ℹ️ The panels may still be resized indirectly (while other panels are being resized).
|
|
752
|
+
To prevent a panel from being resized at all, it needs to also be disabled.</p>
|
|
654
753
|
</td>
|
|
655
754
|
</tr>
|
|
656
755
|
<tr>
|
|
657
|
-
<td>
|
|
658
|
-
<td><p>
|
|
756
|
+
<td>disableDoubleClick</td>
|
|
757
|
+
<td><p>When true, double-clicking this <code>Separator</code> will not reset its <code>Panel</code> to its default size.</p>
|
|
659
758
|
</td>
|
|
660
759
|
</tr>
|
|
661
760
|
<tr>
|
|
@@ -664,66 +763,116 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
664
763
|
</td>
|
|
665
764
|
</tr>
|
|
666
765
|
<tr>
|
|
667
|
-
<td>
|
|
668
|
-
<td><p>
|
|
766
|
+
<td>preview</td>
|
|
767
|
+
<td><p>Overrides the <code>Group</code> default preview for this <code>Separator</code> when <code>resizePreviewMode</code> is "separator".</p>
|
|
669
768
|
</td>
|
|
670
769
|
</tr>
|
|
671
770
|
</tbody>
|
|
672
771
|
</table>
|
|
673
772
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
### Gridline
|
|
677
|
-
|
|
678
|
-
<!-- Gridline:description:begin -->
|
|
679
|
-
Resizes the columns (or rows) of a Grid.
|
|
773
|
+
### TabCloseButton
|
|
680
774
|
|
|
681
|
-
|
|
775
|
+
Closes the tab it is rendered within; render it within the element returned by the Workspace's `renderTab` prop:
|
|
682
776
|
|
|
683
777
|
```tsx
|
|
684
|
-
|
|
685
|
-
<
|
|
778
|
+
renderTab={(tab, props) => (
|
|
779
|
+
<div {...props}>
|
|
780
|
+
{tab.title}
|
|
781
|
+
<TabCloseButton>×</TabCloseButton>
|
|
782
|
+
</div>
|
|
783
|
+
)}
|
|
686
784
|
```
|
|
687
785
|
|
|
786
|
+
The button renders nothing if closing is disabled (by the tab's `disableClose` flag or the Workspace's `disabled` prop).
|
|
787
|
+
Its content defaults to "×" (e.g. it can be replaced with an icon),
|
|
788
|
+
and its default `aria-label` is "Close" followed by the tab's title (or id).
|
|
789
|
+
|
|
790
|
+
Its `children`, `className`, `style`, and `title` can also be functions of its state (see `TabCloseButtonState`):
|
|
791
|
+
|
|
688
792
|
```tsx
|
|
689
|
-
|
|
690
|
-
<Gridline type="row" row={1} />
|
|
793
|
+
<TabCloseButton title={({ tabTitle }) => `Close ${tabTitle}`} />
|
|
691
794
|
```
|
|
692
795
|
|
|
796
|
+
To keep the tab open (e.g. to confirm unsaved changes first), call `event.preventDefault()` in an `onClick` handler:
|
|
797
|
+
|
|
693
798
|
```tsx
|
|
694
|
-
|
|
695
|
-
|
|
799
|
+
<TabCloseButton
|
|
800
|
+
onClick={(event) => {
|
|
801
|
+
if (hasUnsavedChanges && !confirm("Discard unsaved changes?")) {
|
|
802
|
+
event.preventDefault();
|
|
803
|
+
}
|
|
804
|
+
}}
|
|
805
|
+
/>
|
|
696
806
|
```
|
|
697
807
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
render multiple gridlines along the same boundary instead (e.g. before and after the spanning Cell).
|
|
808
|
+
ℹ️ This button is not focusable by default (`tabIndex={-1}`), since tabs shouldn't contain focusable content;
|
|
809
|
+
keyboard users can close the focused tab with Delete or Backspace.
|
|
701
810
|
|
|
702
|
-
|
|
703
|
-
the parts of the boundary that aren't alongside of a gridline can't be dragged.
|
|
811
|
+
#### Required props
|
|
704
812
|
|
|
705
|
-
|
|
813
|
+
None
|
|
706
814
|
|
|
707
|
-
|
|
815
|
+
#### Optional props
|
|
708
816
|
|
|
709
|
-
|
|
817
|
+
<table>
|
|
818
|
+
<thead>
|
|
819
|
+
<tr>
|
|
820
|
+
<th>Name</th>
|
|
821
|
+
<th>Description</th>
|
|
822
|
+
</tr>
|
|
823
|
+
</thead>
|
|
824
|
+
<tbody>
|
|
825
|
+
<tr>
|
|
826
|
+
<td>children</td>
|
|
827
|
+
<td><p>Content of the element, or a function that returns it (given the component's state).</p>
|
|
828
|
+
</td>
|
|
829
|
+
</tr>
|
|
830
|
+
<tr>
|
|
831
|
+
<td>className</td>
|
|
832
|
+
<td><p>Class name of the element, or a function that returns it (given the component's state).</p>
|
|
833
|
+
</td>
|
|
834
|
+
</tr>
|
|
835
|
+
<tr>
|
|
836
|
+
<td>style</td>
|
|
837
|
+
<td><p>Inline styles of the element, or a function that returns them (given the component's state).</p>
|
|
838
|
+
</td>
|
|
839
|
+
</tr>
|
|
840
|
+
<tr>
|
|
841
|
+
<td>title</td>
|
|
842
|
+
<td><p>Tooltip of the element, or a function that returns it (given the component's state).</p>
|
|
843
|
+
</td>
|
|
844
|
+
</tr>
|
|
845
|
+
</tbody>
|
|
846
|
+
</table>
|
|
710
847
|
|
|
711
|
-
|
|
712
|
-
|
|
848
|
+
### TabsetCollapseButton
|
|
849
|
+
|
|
850
|
+
Collapses (or expands) the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop.
|
|
851
|
+
Its `children`, `className`, `style`, and `title` can be functions of its state (see `TabsetCollapseButtonState`), e.g. to show a different icon while the tabset is collapsed:
|
|
852
|
+
|
|
853
|
+
```tsx
|
|
854
|
+
renderTabsetToolbar={() => (
|
|
855
|
+
<TabsetCollapseButton title={({ isCollapsed }) => (isCollapsed ? "Expand" : "Collapse")}>
|
|
856
|
+
{({ isCollapsed }) => (isCollapsed ? "▸" : "▾")}
|
|
857
|
+
</TabsetCollapseButton>
|
|
858
|
+
)}
|
|
713
859
|
```
|
|
714
860
|
|
|
715
|
-
|
|
861
|
+
The button renders nothing if the tabset can't be collapsed (see `ParentTabsetState.isCollapsible`), or while it's maximized.
|
|
862
|
+
While the tabset is collapsed only because it doesn't fit (see `ParentTabsetState.isCollapsedToFit`), it can't be expanded, so the button has `aria-disabled="true"`.
|
|
716
863
|
|
|
717
|
-
|
|
864
|
+
Its `aria-expanded` attribute reflects whether the tabset is expanded, and its `aria-controls` attribute refers to the selected tab's panel;
|
|
865
|
+
its default `aria-label` ("Collapse tabset") doesn't change, since `aria-expanded` describes the state.
|
|
718
866
|
|
|
719
|
-
|
|
867
|
+
To keep the tabset as it is, call `event.preventDefault()` in an `onClick` handler.
|
|
720
868
|
|
|
721
|
-
ℹ️
|
|
722
|
-
<!-- Gridline:description:end -->
|
|
869
|
+
ℹ️ Clicking a tab of a collapsed tabset also expands it.
|
|
723
870
|
|
|
724
871
|
#### Required props
|
|
725
872
|
|
|
726
|
-
|
|
873
|
+
None
|
|
874
|
+
|
|
875
|
+
#### Optional props
|
|
727
876
|
|
|
728
877
|
<table>
|
|
729
878
|
<thead>
|
|
@@ -734,19 +883,57 @@ Gridline elements always include the following attributes:
|
|
|
734
883
|
</thead>
|
|
735
884
|
<tbody>
|
|
736
885
|
<tr>
|
|
737
|
-
<td>
|
|
738
|
-
<td><p>
|
|
739
|
-
|
|
886
|
+
<td>children</td>
|
|
887
|
+
<td><p>Content of the element, or a function that returns it (given the component's state).</p>
|
|
888
|
+
</td>
|
|
889
|
+
</tr>
|
|
890
|
+
<tr>
|
|
891
|
+
<td>className</td>
|
|
892
|
+
<td><p>Class name of the element, or a function that returns it (given the component's state).</p>
|
|
893
|
+
</td>
|
|
894
|
+
</tr>
|
|
895
|
+
<tr>
|
|
896
|
+
<td>style</td>
|
|
897
|
+
<td><p>Inline styles of the element, or a function that returns them (given the component's state).</p>
|
|
898
|
+
</td>
|
|
899
|
+
</tr>
|
|
900
|
+
<tr>
|
|
901
|
+
<td>title</td>
|
|
902
|
+
<td><p>Tooltip of the element, or a function that returns it (given the component's state).</p>
|
|
740
903
|
</td>
|
|
741
904
|
</tr>
|
|
742
905
|
</tbody>
|
|
743
906
|
</table>
|
|
744
907
|
|
|
745
|
-
|
|
908
|
+
### TabsetDragHandle
|
|
746
909
|
|
|
747
|
-
|
|
910
|
+
Drags the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop:
|
|
911
|
+
|
|
912
|
+
```tsx
|
|
913
|
+
renderTabsetToolbar={() => (
|
|
914
|
+
<TabsetDragHandle>⠿</TabsetDragHandle>
|
|
915
|
+
)}
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
By default, a tabset is dragged by the empty space in its header;
|
|
919
|
+
once its header contains a drag handle, only the handle drags it.
|
|
920
|
+
Any element with a `data-tabset-drag-handle` attribute is a drag handle;
|
|
921
|
+
this component also sets `touch-action: none`, so that it can be dragged by touch.
|
|
922
|
+
|
|
923
|
+
The handle has a `data-disabled` attribute when the tabset can't be dragged (see `useParentTabsetState`), e.g. to hide it.
|
|
924
|
+
Its `children`, `className`, `style`, and `title` can also be functions of its state (see `TabsetDragHandleState`):
|
|
925
|
+
|
|
926
|
+
```tsx
|
|
927
|
+
<TabsetDragHandle title={({ isDisabled }) => (isDisabled ? undefined : "Drag tabset")}>
|
|
928
|
+
⠿
|
|
929
|
+
</TabsetDragHandle>
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
#### Required props
|
|
933
|
+
|
|
934
|
+
None
|
|
748
935
|
|
|
749
|
-
|
|
936
|
+
#### Optional props
|
|
750
937
|
|
|
751
938
|
<table>
|
|
752
939
|
<thead>
|
|
@@ -758,69 +945,86 @@ Row gridlines are horizontal; they resize the rows on either side of them.</p>
|
|
|
758
945
|
<tbody>
|
|
759
946
|
<tr>
|
|
760
947
|
<td>children</td>
|
|
761
|
-
<td><p>
|
|
948
|
+
<td><p>Content of the element, or a function that returns it (given the component's state).</p>
|
|
762
949
|
</td>
|
|
763
950
|
</tr>
|
|
764
951
|
<tr>
|
|
765
952
|
<td>className</td>
|
|
766
|
-
<td><p>
|
|
767
|
-
<p>ℹ️ Use the <code>data-separator</code> attribute for custom <em>hover</em> and <em>active</em> styles</p>
|
|
953
|
+
<td><p>Class name of the element, or a function that returns it (given the component's state).</p>
|
|
768
954
|
</td>
|
|
769
955
|
</tr>
|
|
770
956
|
<tr>
|
|
771
|
-
<td>
|
|
772
|
-
<td><p>
|
|
773
|
-
<p>ℹ️ The tracks may still be resized indirectly (e.g. by an intersecting gridline or another boundary).
|
|
774
|
-
To prevent a track from being resized at all, it needs to also be disabled.</p>
|
|
957
|
+
<td>style</td>
|
|
958
|
+
<td><p>Inline styles of the element, or a function that returns them (given the component's state).</p>
|
|
775
959
|
</td>
|
|
776
960
|
</tr>
|
|
777
961
|
<tr>
|
|
778
|
-
<td>
|
|
779
|
-
<td><p>
|
|
962
|
+
<td>title</td>
|
|
963
|
+
<td><p>Tooltip of the element, or a function that returns it (given the component's state).</p>
|
|
780
964
|
</td>
|
|
781
965
|
</tr>
|
|
966
|
+
</tbody>
|
|
967
|
+
</table>
|
|
968
|
+
|
|
969
|
+
### TabsetMaximizeButton
|
|
970
|
+
|
|
971
|
+
Maximizes (or restores) the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop.
|
|
972
|
+
Its `children`, `className`, `style`, and `title` can be functions of its state (see `TabsetMaximizeButtonState`), e.g. to show a different icon while the tabset is maximized:
|
|
973
|
+
|
|
974
|
+
```tsx
|
|
975
|
+
renderTabsetToolbar={() => (
|
|
976
|
+
<TabsetMaximizeButton title={({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}>
|
|
977
|
+
{({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}
|
|
978
|
+
</TabsetMaximizeButton>
|
|
979
|
+
)}
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
The button renders nothing for the only tabset in a workspace (see `ParentTabsetState.isRoot`) and for floating tabsets, which can't be maximized.
|
|
983
|
+
|
|
984
|
+
Its `aria-pressed` attribute reflects whether the tabset is maximized;
|
|
985
|
+
its default `aria-label` ("Maximize tabset") doesn't change, since `aria-pressed` describes the state.
|
|
986
|
+
|
|
987
|
+
To keep the tabset as it is, call `event.preventDefault()` in an `onClick` handler.
|
|
988
|
+
|
|
989
|
+
#### Required props
|
|
990
|
+
|
|
991
|
+
None
|
|
992
|
+
|
|
993
|
+
#### Optional props
|
|
994
|
+
|
|
995
|
+
<table>
|
|
996
|
+
<thead>
|
|
782
997
|
<tr>
|
|
783
|
-
<
|
|
784
|
-
<
|
|
785
|
-
<p>⚠️ Grid placement properties are managed by the gridline and cannot be overridden.</p>
|
|
786
|
-
</td>
|
|
998
|
+
<th>Name</th>
|
|
999
|
+
<th>Description</th>
|
|
787
1000
|
</tr>
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1001
|
+
</thead>
|
|
1002
|
+
<tbody>
|
|
1003
|
+
<tr>
|
|
1004
|
+
<td>children</td>
|
|
1005
|
+
<td><p>Content of the element, or a function that returns it (given the component's state).</p>
|
|
793
1006
|
</td>
|
|
794
1007
|
</tr>
|
|
795
1008
|
<tr>
|
|
796
|
-
<td>
|
|
797
|
-
<td><p>
|
|
798
|
-
When <code>type</code> is "row", the gridline is rendered along the leading (top) edge of this row
|
|
799
|
-
(between it and the previous row); must be greater than 0 and less than the number of rows.</p>
|
|
1009
|
+
<td>className</td>
|
|
1010
|
+
<td><p>Class name of the element, or a function that returns it (given the component's state).</p>
|
|
800
1011
|
</td>
|
|
801
1012
|
</tr>
|
|
802
1013
|
<tr>
|
|
803
|
-
<td>
|
|
804
|
-
<td><p>
|
|
805
|
-
<p>ℹ️ Gridlines can span a subset of rows in order to avoid cells that span across the boundary they sit on;
|
|
806
|
-
multiple gridlines can be rendered along the same boundary (e.g. above and below a spanning cell).</p>
|
|
1014
|
+
<td>style</td>
|
|
1015
|
+
<td><p>Inline styles of the element, or a function that returns them (given the component's state).</p>
|
|
807
1016
|
</td>
|
|
808
1017
|
</tr>
|
|
809
1018
|
<tr>
|
|
810
|
-
<td>
|
|
811
|
-
<td><p>
|
|
812
|
-
<p>ℹ️ Gridlines can span a subset of columns in order to avoid cells that span across the boundary they sit on;
|
|
813
|
-
multiple gridlines can be rendered along the same boundary (e.g. before and after a spanning cell).</p>
|
|
1019
|
+
<td>title</td>
|
|
1020
|
+
<td><p>Tooltip of the element, or a function that returns it (given the component's state).</p>
|
|
814
1021
|
</td>
|
|
815
1022
|
</tr>
|
|
816
1023
|
</tbody>
|
|
817
1024
|
</table>
|
|
818
1025
|
|
|
819
|
-
<!-- Gridline:optional-props:end -->
|
|
820
|
-
|
|
821
1026
|
### Workspace
|
|
822
1027
|
|
|
823
|
-
<!-- Workspace:description:begin -->
|
|
824
1028
|
A Workspace arranges tabsets that users can rearrange by dragging tabs:
|
|
825
1029
|
between tabsets, within a tabset's list of tabs, or onto the edge of a tabset to split it.
|
|
826
1030
|
Tabsets can be resized and maximized.
|
|
@@ -839,12 +1043,9 @@ Workspace elements always include the following attributes:
|
|
|
839
1043
|
```
|
|
840
1044
|
|
|
841
1045
|
ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
|
|
842
|
-
<!-- Workspace:description:end -->
|
|
843
1046
|
|
|
844
1047
|
#### Required props
|
|
845
1048
|
|
|
846
|
-
<!-- Workspace:required-props:begin -->
|
|
847
|
-
|
|
848
1049
|
<table>
|
|
849
1050
|
<thead>
|
|
850
1051
|
<tr>
|
|
@@ -871,12 +1072,8 @@ so it should be memoized (e.g. with <code>useCallback</code>) when tab content i
|
|
|
871
1072
|
</tbody>
|
|
872
1073
|
</table>
|
|
873
1074
|
|
|
874
|
-
<!-- Workspace:required-props:end -->
|
|
875
|
-
|
|
876
1075
|
#### Optional props
|
|
877
1076
|
|
|
878
|
-
<!-- Workspace:optional-props:begin -->
|
|
879
|
-
|
|
880
1077
|
<table>
|
|
881
1078
|
<thead>
|
|
882
1079
|
<tr>
|
|
@@ -900,6 +1097,18 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
900
1097
|
<tr>
|
|
901
1098
|
<td>style</td>
|
|
902
1099
|
<td><p>CSS properties.</p>
|
|
1100
|
+
</td>
|
|
1101
|
+
</tr>
|
|
1102
|
+
<tr>
|
|
1103
|
+
<td>acceptExternalDrop</td>
|
|
1104
|
+
<td><p>Lets the workspace accept drags that use the browser's drag and drop from outside of any workspace
|
|
1105
|
+
(e.g. an element of the application with the <code>draggable</code> attribute, a file, or a link from another application),
|
|
1106
|
+
showing the drop indicator while the drag is over the workspace, and creating a tab where it's dropped.
|
|
1107
|
+
The new tab is reported to <code>onModelChanged</code> with the <code>"add"</code> reason.</p>
|
|
1108
|
+
<p>ℹ️ <code>disableDrop</code> can't be called until the tab is created (when the drag is dropped), so a target it rejects is shown as accepted while dragging;
|
|
1109
|
+
the drop is ignored then. Drag sources within the application can use the imperative <code>startExternalDrag</code> method instead, which doesn't have this limitation.</p>
|
|
1110
|
+
<p>ℹ️ Elements within the workspace's tab content that handle the same drags themselves (by canceling the <code>dragover</code> and <code>drop</code> events) take precedence.</p>
|
|
1111
|
+
<p>ℹ️ This object is read when drag events are handled, so it doesn't need to be memoized.</p>
|
|
903
1112
|
</td>
|
|
904
1113
|
</tr>
|
|
905
1114
|
<tr>
|
|
@@ -925,6 +1134,37 @@ Its <code>data-region</code> attribute is the region of a tabset's panels it
|
|
|
925
1134
|
while a tab isn't over either, it has neither and isn't shown (<code>opacity: 0</code>).</p>
|
|
926
1135
|
<p>ℹ️ Like the render props, this object is part of what tabsets re-render for;
|
|
927
1136
|
in large workspaces, define it outside of the component (or memoize it) rather than inline.</p>
|
|
1137
|
+
</td>
|
|
1138
|
+
</tr>
|
|
1139
|
+
<tr>
|
|
1140
|
+
<td>copyTab</td>
|
|
1141
|
+
<td><p>Lets tabs be copied by dragging them: a tab dropped while the copy modifier key is held (Option on macOS, Ctrl elsewhere) adds the copy this function returns,
|
|
1142
|
+
leaving the dragged tab where it was. The change is reported to <code>onModelChanged</code> with the <code>"copy"</code> reason.</p>
|
|
1143
|
+
<p>Returning <code>null</code> (or <code>undefined</code>) moves the dragged tab instead. If that move isn't allowed either (the <code>disableDrop</code> prop rejects it, the ids conflict, or it isn't a valid place to move the tab), nothing happens.</p>
|
|
1144
|
+
<p>ℹ️ The copy needs an id that isn't used by any other node of the workspace (e.g. <code>crypto.randomUUID()</code>); copies with ids that are in use are rejected (and the tab is moved instead).</p>
|
|
1145
|
+
<p>ℹ️ The workspace the tab is dropped into makes the copy, so a tab dragged from another workspace (see the <code>dragGroup</code> prop) is copied by the workspace it's dropped into
|
|
1146
|
+
(and is only copied if that workspace has this prop).</p>
|
|
1147
|
+
<ul>
|
|
1148
|
+
<li><code>tab</code> The tab being dragged</li>
|
|
1149
|
+
<li><code>target</code> Where the copy will be dropped</li>
|
|
1150
|
+
</ul>
|
|
1151
|
+
</td>
|
|
1152
|
+
</tr>
|
|
1153
|
+
<tr>
|
|
1154
|
+
<td>copyTabset</td>
|
|
1155
|
+
<td><p>Lets tabsets be copied by dragging them (by their headers), like the <code>copyTab</code> prop does for tabs: a tabset dropped while the copy modifier key is held adds the copy this function returns,
|
|
1156
|
+
leaving the dragged tabset where it was. The change is reported to <code>onModelChanged</code> with the <code>"copy"</code> reason.</p>
|
|
1157
|
+
<p>The copy includes its tabs, which need ids that aren't used by any other node of the workspace too; the <code>copyTab</code> argument copies a tab:</p>
|
|
1158
|
+
<pre><code class="language-tsx">copyTabset={(tabset, copyTab) => ({ ...tabset, id: crypto.randomUUID(), tabs: tabset.tabs.map(copyTab) })}
|
|
1159
|
+
</code></pre>
|
|
1160
|
+
<p>Returning <code>null</code> (or <code>undefined</code>) moves the dragged tabset instead. If that move isn't allowed either (the <code>disableDrop</code> prop rejects it, the ids conflict, a <code>keepWhenEmpty</code> tabset is dropped into another workspace, or it isn't a valid place to move the tabset), nothing happens.</p>
|
|
1161
|
+
<p>ℹ️ The copy's selected tab is the copy of the dragged tabset's selected tab (matched by position), unless the copy selects one of its own tabs.</p>
|
|
1162
|
+
<p>ℹ️ A copy dropped into a tab list (or onto the center of another tabset) only adds its tabs; its id and data are only used where it's added as a tabset.</p>
|
|
1163
|
+
<ul>
|
|
1164
|
+
<li><code>tabset</code> The tabset being dragged</li>
|
|
1165
|
+
<li><code>copyTab</code> Copies a tab with the <code>copyTab</code> prop (and the same drop target); without that prop (or if it returns <code>null</code>), the copy is a shallow copy of the tab with a new id</li>
|
|
1166
|
+
<li><code>target</code> Where the copy will be dropped</li>
|
|
1167
|
+
</ul>
|
|
928
1168
|
</td>
|
|
929
1169
|
</tr>
|
|
930
1170
|
<tr>
|
|
@@ -968,7 +1208,6 @@ A tab dragged to another workspace is rendered by that workspace, so its content
|
|
|
968
1208
|
<p>⚠️ A tab dragged to another copy of the application is sent there with the structured clone algorithm (like <code>postMessage</code>), so its data must be cloneable (e.g. no functions);
|
|
969
1209
|
tabs whose data can't be cloned (and tabsets containing them) can only be dragged within their copy of the application.
|
|
970
1210
|
Copies loaded at different times may be running different versions of the application, so the other copy may need to handle tab data it doesn't recognize.</p>
|
|
971
|
-
<p>⚠️ Tabs (and tabsets) can still be torn off (see <code>onTearOff</code>), but some browsers (e.g. Safari) block popup windows opened at the end of a drag that uses the browser's drag and drop.</p>
|
|
972
1211
|
</td>
|
|
973
1212
|
</tr>
|
|
974
1213
|
<tr>
|
|
@@ -1010,13 +1249,16 @@ and return <code>false</code> then to keep the tab; returning <code>true</code>
|
|
|
1010
1249
|
<p>ℹ️ This is called while the release of the pointer is being handled (which browsers treat as user input), so a popup can be opened from it.
|
|
1011
1250
|
With the <code>dragGroup</code> prop, a tab is torn off when it's dropped outside of every window in the group; the end of those drags isn't treated as user input,
|
|
1012
1251
|
so browsers block popups opened then unless the drag started a few seconds earlier at most (and Safari blocks them always).</p>
|
|
1252
|
+
<p>⚠️ Deprecated: browsers don't reliably report where a drag that leaves the window ends, and some block popups opened at the end of a drag.
|
|
1253
|
+
Open popout windows from a button instead (see <code>usePopoutWindows</code>). This will be removed in the next major version.</p>
|
|
1254
|
+
<p>❌ This prop has been deprecated. Open popout windows from a button instead (see <code>usePopoutWindows</code>).</p>
|
|
1013
1255
|
</td>
|
|
1014
1256
|
</tr>
|
|
1015
1257
|
<tr>
|
|
1016
1258
|
<td>renderDragPreview</td>
|
|
1017
1259
|
<td><p>Content of the element that follows the pointer while a tab is being dragged.
|
|
1018
1260
|
Defaults to the tab's title (or id).</p>
|
|
1019
|
-
<p>ℹ️ The element has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tab (see <code>onTearOff</code>).</p>
|
|
1261
|
+
<p>ℹ️ The element has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tab (see the deprecated <code>onTearOff</code> prop).</p>
|
|
1020
1262
|
</td>
|
|
1021
1263
|
</tr>
|
|
1022
1264
|
<tr>
|
|
@@ -1024,7 +1266,7 @@ Defaults to the tab's title (or id).</p>
|
|
|
1024
1266
|
<td><p>Content of the element that follows the pointer while a whole tabset is being dragged.
|
|
1025
1267
|
Defaults to the title (or id) of its selected tab followed by the number of other tabs being dragged (e.g. "One (+2)"), or the selected tab's <code>renderDragPreview</code> when that prop is set, or the tabset's id if it has no tabs.</p>
|
|
1026
1268
|
<p>ℹ️ The element has a <code>data-drag-type</code> attribute: <code>"tabset"</code> while a tabset is dragged, and <code>"tab"</code> while a tab is.
|
|
1027
|
-
It also has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tabset (see <code>onTearOff</code>).</p>
|
|
1269
|
+
It also has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tabset (see the deprecated <code>onTearOff</code> prop).</p>
|
|
1028
1270
|
</td>
|
|
1029
1271
|
</tr>
|
|
1030
1272
|
<tr>
|
|
@@ -1147,57 +1389,134 @@ so they're restored with the rest of the layout.</p>
|
|
|
1147
1389
|
</tbody>
|
|
1148
1390
|
</table>
|
|
1149
1391
|
|
|
1150
|
-
|
|
1392
|
+
## Imperative APIs
|
|
1151
1393
|
|
|
1152
|
-
###
|
|
1394
|
+
### GridImperativeHandle
|
|
1153
1395
|
|
|
1154
|
-
|
|
1155
|
-
Closes the tab it is rendered within; render it within the element returned by the Workspace's `renderTab` prop:
|
|
1396
|
+
Imperative Grid API.
|
|
1156
1397
|
|
|
1157
|
-
|
|
1158
|
-
renderTab={(tab, props) => (
|
|
1159
|
-
<div {...props}>
|
|
1160
|
-
{tab.title}
|
|
1161
|
-
<TabCloseButton>×</TabCloseButton>
|
|
1162
|
-
</div>
|
|
1163
|
-
)}
|
|
1164
|
-
```
|
|
1398
|
+
ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
1165
1399
|
|
|
1166
|
-
|
|
1167
|
-
Its content defaults to "×" (e.g. it can be replaced with an icon),
|
|
1168
|
-
and its default `aria-label` is "Close" followed by the tab's title (or id).
|
|
1400
|
+
#### Methods
|
|
1169
1401
|
|
|
1170
|
-
|
|
1402
|
+
<table>
|
|
1403
|
+
<thead>
|
|
1404
|
+
<tr>
|
|
1405
|
+
<th>Name</th>
|
|
1406
|
+
<th>Description</th>
|
|
1407
|
+
</tr>
|
|
1408
|
+
</thead>
|
|
1409
|
+
<tbody>
|
|
1410
|
+
<tr>
|
|
1411
|
+
<td>getLayout</td>
|
|
1412
|
+
<td><p>Get the Grid's current layout: maps of column and row ids to percentages (0..100)</p>
|
|
1413
|
+
</td>
|
|
1414
|
+
</tr>
|
|
1415
|
+
<tr>
|
|
1416
|
+
<td>getTrackById</td>
|
|
1417
|
+
<td><p>Imperative API for the column or row with the specified id (see <code>GridTrackImperativeHandle</code>).</p>
|
|
1418
|
+
<p>ℹ️ Tracks without an explicit <code>id</code> use their index (e.g. <code>"0"</code>) as their id.</p>
|
|
1419
|
+
<p>⚠️ An error will be thrown if the Grid does not contain a matching track.</p>
|
|
1420
|
+
<ul>
|
|
1421
|
+
<li><code>axis</code> "column" or "row"</li>
|
|
1422
|
+
<li><code>id</code> Track id</li>
|
|
1423
|
+
</ul>
|
|
1424
|
+
</td>
|
|
1425
|
+
</tr>
|
|
1426
|
+
<tr>
|
|
1427
|
+
<td>getTrackByIndex</td>
|
|
1428
|
+
<td><p>Imperative API for the column or row at the specified index (see <code>GridTrackImperativeHandle</code>).</p>
|
|
1429
|
+
<p>ℹ️ The index is resolved to a track id when this method is called; the returned API continues to refer to that id.
|
|
1430
|
+
Tracks without an explicit <code>id</code> use their index as their id,
|
|
1431
|
+
so specify ids if the API needs to refer to the same track after tracks are added or removed before it.</p>
|
|
1432
|
+
<p>⚠️ An error will be thrown if the index is out of range.</p>
|
|
1433
|
+
<ul>
|
|
1434
|
+
<li><code>axis</code> "column" or "row"</li>
|
|
1435
|
+
<li><code>index</code> Track index (starting at 0)</li>
|
|
1436
|
+
</ul>
|
|
1437
|
+
</td>
|
|
1438
|
+
</tr>
|
|
1439
|
+
<tr>
|
|
1440
|
+
<td>setLayout</td>
|
|
1441
|
+
<td><p>Set a new layout for one or both of the Grid's axes.</p>
|
|
1442
|
+
<ul>
|
|
1443
|
+
<li><code>layout</code> Map of column and/or row ids to percentages (numbers between 0..100)</li>
|
|
1444
|
+
</ul>
|
|
1445
|
+
</td>
|
|
1446
|
+
</tr>
|
|
1447
|
+
</tbody>
|
|
1448
|
+
</table>
|
|
1171
1449
|
|
|
1172
|
-
|
|
1173
|
-
<TabCloseButton title={({ tabTitle }) => `Close ${tabTitle}`} />
|
|
1174
|
-
```
|
|
1450
|
+
### GridTrackImperativeHandle
|
|
1175
1451
|
|
|
1176
|
-
|
|
1452
|
+
Imperative API for an individual Grid track (column or row); returned by `GridImperativeHandle.getTrackById` and `GridImperativeHandle.getTrackByIndex`.
|
|
1177
1453
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
onClick={(event) => {
|
|
1181
|
-
if (hasUnsavedChanges && !confirm("Discard unsaved changes?")) {
|
|
1182
|
-
event.preventDefault();
|
|
1183
|
-
}
|
|
1184
|
-
}}
|
|
1185
|
-
/>
|
|
1186
|
-
```
|
|
1454
|
+
ℹ️ Sizes are relative to the space available to the track's axis
|
|
1455
|
+
(e.g. the width of the Grid, minus gaps and gridlines, for a column).
|
|
1187
1456
|
|
|
1188
|
-
|
|
1189
|
-
keyboard users can close the focused tab with Delete or Backspace.
|
|
1190
|
-
<!-- TabCloseButton:description:end -->
|
|
1457
|
+
#### Methods
|
|
1191
1458
|
|
|
1192
|
-
|
|
1459
|
+
<table>
|
|
1460
|
+
<thead>
|
|
1461
|
+
<tr>
|
|
1462
|
+
<th>Name</th>
|
|
1463
|
+
<th>Description</th>
|
|
1464
|
+
</tr>
|
|
1465
|
+
</thead>
|
|
1466
|
+
<tbody>
|
|
1467
|
+
<tr>
|
|
1468
|
+
<td>collapse</td>
|
|
1469
|
+
<td><p>Collapse the track to its <code>collapsedSize</code>.</p>
|
|
1470
|
+
<p>⚠️ This method will do nothing if the track is not <code>collapsible</code> or if it is already collapsed.</p>
|
|
1471
|
+
</td>
|
|
1472
|
+
</tr>
|
|
1473
|
+
<tr>
|
|
1474
|
+
<td>expand</td>
|
|
1475
|
+
<td><p>Expand a collapsed track to its most recent size.</p>
|
|
1476
|
+
<p>ℹ️ If restoring that size would require collapsing another track, the track expands to the largest size that fits instead (as long as that is at least its <code>minSize</code>).</p>
|
|
1477
|
+
<p>⚠️ This method will do nothing if the track is not currently collapsed.</p>
|
|
1478
|
+
</td>
|
|
1479
|
+
</tr>
|
|
1480
|
+
<tr>
|
|
1481
|
+
<td>getSize</td>
|
|
1482
|
+
<td><p>Get the current size of the track in pixels as well as a percentage of its axis (0..100).</p>
|
|
1483
|
+
</td>
|
|
1484
|
+
</tr>
|
|
1485
|
+
<tr>
|
|
1486
|
+
<td>isCollapsed</td>
|
|
1487
|
+
<td><p>The track is currently collapsed.</p>
|
|
1488
|
+
</td>
|
|
1489
|
+
</tr>
|
|
1490
|
+
<tr>
|
|
1491
|
+
<td>resize</td>
|
|
1492
|
+
<td><p>Update the track's size.
|
|
1493
|
+
Size can be in the following formats:</p>
|
|
1494
|
+
<ul>
|
|
1495
|
+
<li>Percentage of the axis (0..100)</li>
|
|
1496
|
+
<li>Pixels</li>
|
|
1497
|
+
<li>Relative font units (em, rem)</li>
|
|
1498
|
+
<li>Viewport relative units (vh, vw)</li>
|
|
1499
|
+
</ul>
|
|
1500
|
+
<p>ℹ️ Numeric values are assumed to be pixels.
|
|
1501
|
+
Strings without explicit units are assumed to be percentages (0%..100%).
|
|
1502
|
+
Percentages may also be specified as strings ending with "%" (e.g. "33%")
|
|
1503
|
+
Pixels may also be specified as strings ending with the unit "px".
|
|
1504
|
+
Other units should be specified as strings ending with their CSS property units (e.g. 1rem, 50vh)</p>
|
|
1505
|
+
<ul>
|
|
1506
|
+
<li><code>size</code> New track size</li>
|
|
1507
|
+
</ul>
|
|
1508
|
+
</td>
|
|
1509
|
+
</tr>
|
|
1510
|
+
</tbody>
|
|
1511
|
+
</table>
|
|
1193
1512
|
|
|
1194
|
-
|
|
1195
|
-
None
|
|
1196
|
-
<!-- TabCloseButton:required-props:end -->
|
|
1513
|
+
### GroupImperativeHandle
|
|
1197
1514
|
|
|
1198
|
-
|
|
1515
|
+
Imperative Group API.
|
|
1516
|
+
|
|
1517
|
+
ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
1199
1518
|
|
|
1200
|
-
|
|
1519
|
+
#### Methods
|
|
1201
1520
|
|
|
1202
1521
|
<table>
|
|
1203
1522
|
<thead>
|
|
@@ -1208,26 +1527,279 @@ None
|
|
|
1208
1527
|
</thead>
|
|
1209
1528
|
<tbody>
|
|
1210
1529
|
<tr>
|
|
1211
|
-
<td>
|
|
1212
|
-
<td><p>
|
|
1530
|
+
<td>getLayout</td>
|
|
1531
|
+
<td><p>Get the Group's current layout as a map of Panel id to percentage (0..100)</p>
|
|
1213
1532
|
</td>
|
|
1214
1533
|
</tr>
|
|
1215
1534
|
<tr>
|
|
1216
|
-
<td>
|
|
1217
|
-
<td><p>
|
|
1535
|
+
<td>setLayout</td>
|
|
1536
|
+
<td><p>Set a new layout for the Group</p>
|
|
1537
|
+
<ul>
|
|
1538
|
+
<li><code>layout</code> Map of Panel id to percentage (a number between 0..100)</li>
|
|
1539
|
+
</ul>
|
|
1540
|
+
</td>
|
|
1541
|
+
</tr>
|
|
1542
|
+
</tbody>
|
|
1543
|
+
</table>
|
|
1544
|
+
|
|
1545
|
+
### PanelImperativeHandle
|
|
1546
|
+
|
|
1547
|
+
Imperative Panel API
|
|
1548
|
+
|
|
1549
|
+
ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
1550
|
+
|
|
1551
|
+
#### Methods
|
|
1552
|
+
|
|
1553
|
+
<table>
|
|
1554
|
+
<thead>
|
|
1555
|
+
<tr>
|
|
1556
|
+
<th>Name</th>
|
|
1557
|
+
<th>Description</th>
|
|
1558
|
+
</tr>
|
|
1559
|
+
</thead>
|
|
1560
|
+
<tbody>
|
|
1561
|
+
<tr>
|
|
1562
|
+
<td>collapse</td>
|
|
1563
|
+
<td><p>Collapse the Panel to its <code>collapsedSize</code>.</p>
|
|
1564
|
+
<p>⚠️ This method will do nothing if the Panel is not <code>collapsible</code> or if it is already collapsed.</p>
|
|
1218
1565
|
</td>
|
|
1219
1566
|
</tr>
|
|
1220
1567
|
<tr>
|
|
1221
|
-
<td>
|
|
1222
|
-
<td><p>
|
|
1568
|
+
<td>expand</td>
|
|
1569
|
+
<td><p>Expand a collapsed Panel to its most recent size.</p>
|
|
1570
|
+
<p>ℹ️ If restoring that size would require collapsing another Panel, the Panel expands to the largest size that fits instead (as long as that is at least its <code>minSize</code>).</p>
|
|
1571
|
+
<p>⚠️ This method will do nothing if the Panel is not currently collapsed.</p>
|
|
1223
1572
|
</td>
|
|
1224
1573
|
</tr>
|
|
1225
1574
|
<tr>
|
|
1226
|
-
<td>
|
|
1227
|
-
<td><p>
|
|
1575
|
+
<td>getSize</td>
|
|
1576
|
+
<td><p>Get the current size of the Panel in pixels as well as a percentage of the parent group (0..100).</p>
|
|
1577
|
+
</td>
|
|
1578
|
+
</tr>
|
|
1579
|
+
<tr>
|
|
1580
|
+
<td>isCollapsed</td>
|
|
1581
|
+
<td><p>The Panel is currently collapsed.</p>
|
|
1582
|
+
</td>
|
|
1583
|
+
</tr>
|
|
1584
|
+
<tr>
|
|
1585
|
+
<td>resize</td>
|
|
1586
|
+
<td><p>Update the Panel's size.
|
|
1587
|
+
Size can be in the following formats:</p>
|
|
1588
|
+
<ul>
|
|
1589
|
+
<li>Percentage of the parent Group (0..100)</li>
|
|
1590
|
+
<li>Pixels</li>
|
|
1591
|
+
<li>Relative font units (em, rem)</li>
|
|
1592
|
+
<li>Viewport relative units (vh, vw)</li>
|
|
1593
|
+
</ul>
|
|
1594
|
+
<p>ℹ️ Numeric values are assumed to be pixels.
|
|
1595
|
+
Strings without explicit units are assumed to be percentages (0%..100%).
|
|
1596
|
+
Percentages may also be specified as strings ending with "%" (e.g. "33%")
|
|
1597
|
+
Pixels may also be specified as strings ending with the unit "px".
|
|
1598
|
+
Other units should be specified as strings ending with their CSS property units (e.g. 1rem, 50vh)</p>
|
|
1599
|
+
<ul>
|
|
1600
|
+
<li><code>size</code> New panel size</li>
|
|
1601
|
+
</ul>
|
|
1602
|
+
</td>
|
|
1603
|
+
</tr>
|
|
1604
|
+
</tbody>
|
|
1605
|
+
</table>
|
|
1606
|
+
|
|
1607
|
+
### WorkspaceImperativeHandle
|
|
1608
|
+
|
|
1609
|
+
Imperative Workspace API.
|
|
1610
|
+
The easiest way to interact with this API is to use the `useWorkspaceRef` and `useWorkspaceCallbackRef` hooks.
|
|
1611
|
+
|
|
1612
|
+
ℹ️ These methods are not restricted by `disabled`, `disableClose`, `disableDrag`, or `disableDrop`.
|
|
1613
|
+
|
|
1614
|
+
#### Methods
|
|
1615
|
+
|
|
1616
|
+
<table>
|
|
1617
|
+
<thead>
|
|
1618
|
+
<tr>
|
|
1619
|
+
<th>Name</th>
|
|
1620
|
+
<th>Description</th>
|
|
1621
|
+
</tr>
|
|
1622
|
+
</thead>
|
|
1623
|
+
<tbody>
|
|
1624
|
+
<tr>
|
|
1625
|
+
<td>addTab</td>
|
|
1626
|
+
<td><p>Add a tab to a tabset.</p>
|
|
1627
|
+
<p>ℹ️ If a tab with the same id already exists, it is selected instead (and its data is not changed).</p>
|
|
1628
|
+
<ul>
|
|
1629
|
+
<li><code>tab</code> Tab to add</li>
|
|
1630
|
+
<li><code>options</code> .tabsetId Tabset to add the tab to; defaults to the active tabset</li>
|
|
1631
|
+
<li><code>options</code> .index Position within the tabset; defaults to the end</li>
|
|
1632
|
+
<li><code>options</code> .select Select the new tab; defaults to true</li>
|
|
1633
|
+
</ul>
|
|
1634
|
+
</td>
|
|
1635
|
+
</tr>
|
|
1636
|
+
<tr>
|
|
1637
|
+
<td>closeTab</td>
|
|
1638
|
+
<td><p>Close a tab.</p>
|
|
1639
|
+
</td>
|
|
1640
|
+
</tr>
|
|
1641
|
+
<tr>
|
|
1642
|
+
<td>closeTabset</td>
|
|
1643
|
+
<td><p>Close a tabset, along with any tabs it contains (e.g. to remove an empty tabset with the <code>keepWhenEmpty</code> flag).</p>
|
|
1644
|
+
<p>ℹ️ Like the rest of the imperative API, this isn't restricted by tabs' <code>disableClose</code> flags.
|
|
1645
|
+
If the root tabset is closed, the workspace is left with an empty root tabset.</p>
|
|
1646
|
+
</td>
|
|
1647
|
+
</tr>
|
|
1648
|
+
<tr>
|
|
1649
|
+
<td>collapseTabset</td>
|
|
1650
|
+
<td><p>Collapse a tabset to just its header.</p>
|
|
1651
|
+
<p>ℹ️ This has no effect unless the tabset has the <code>collapsible</code> flag (or is floating; see <code>FloatingTabsetNode</code>);
|
|
1652
|
+
the only tabset in a workspace, and tabsets whose siblings are all collapsed, can't be collapsed.</p>
|
|
1653
|
+
</td>
|
|
1654
|
+
</tr>
|
|
1655
|
+
<tr>
|
|
1656
|
+
<td>expandTabset</td>
|
|
1657
|
+
<td><p>Expand a collapsed tabset to its previous size.</p>
|
|
1658
|
+
<p>ℹ️ Tabsets are shown at least at their minimum sizes (if they fit), even if the model's sizes are smaller (see <code>TabsetNode.size</code>).</p>
|
|
1659
|
+
<p>ℹ️ This has no effect on a tabset that's only collapsed to fit, which is expanded once it fits (see <code>TabsetNode.collapsible</code>).</p>
|
|
1660
|
+
</td>
|
|
1661
|
+
</tr>
|
|
1662
|
+
<tr>
|
|
1663
|
+
<td>floatTab</td>
|
|
1664
|
+
<td><p>Move a tab into a new floating tabset (see <code>WorkspaceModel.floating</code>), on top of any other floating tabsets.</p>
|
|
1665
|
+
<p>ℹ️ Parts of the position and size that aren't specified default to those of the tab's tabset, offset slightly down and to the right
|
|
1666
|
+
(and moved, if needed, to fit within the workspace).</p>
|
|
1667
|
+
<p>ℹ️ This has no effect on the only tab of a floating tabset (unless the tabset has the <code>keepWhenEmpty</code> flag).</p>
|
|
1668
|
+
</td>
|
|
1669
|
+
</tr>
|
|
1670
|
+
<tr>
|
|
1671
|
+
<td>floatTabset</td>
|
|
1672
|
+
<td><p>Move a tabset out of the layout, to float above it (see <code>WorkspaceModel.floating</code>), on top of any other floating tabsets.</p>
|
|
1673
|
+
<p>ℹ️ Parts of the position and size that aren't specified default to those of the tabset, offset slightly down and to the right
|
|
1674
|
+
(and moved, if needed, to fit within the workspace).</p>
|
|
1675
|
+
<p>ℹ️ This has no effect on the root tabset (which fills the workspace) or a tabset that's already floating.
|
|
1676
|
+
A maximized tabset is restored first.</p>
|
|
1677
|
+
</td>
|
|
1678
|
+
</tr>
|
|
1679
|
+
<tr>
|
|
1680
|
+
<td>getActiveTabsetId</td>
|
|
1681
|
+
<td><p>Id of the tabset the user most recently interacted with (by pointer or focus).</p>
|
|
1682
|
+
</td>
|
|
1683
|
+
</tr>
|
|
1684
|
+
<tr>
|
|
1685
|
+
<td>getModel</td>
|
|
1686
|
+
<td><p>Get the current model.</p>
|
|
1687
|
+
</td>
|
|
1688
|
+
</tr>
|
|
1689
|
+
<tr>
|
|
1690
|
+
<td>getTabListFreeSpace</td>
|
|
1691
|
+
<td><p>Space (in pixels) in a tabset's tab list that its tabs don't use, e.g. how much a toolbar beside the tabs could grow
|
|
1692
|
+
before they overflow (and how much space an overflow menu needs to free up, once it's negative).</p>
|
|
1693
|
+
<p>ℹ️ The space is measured along the tab list: its width, or its height if its tabs are placed on the left or right
|
|
1694
|
+
(or the tabset is collapsed to a vertical strip).
|
|
1695
|
+
If the tab list can't shrink any further (e.g. it's 0px wide, beside a toolbar that doesn't shrink), the amount the header's content
|
|
1696
|
+
overflows the header is subtracted too, so it's still how much space a toolbar needs to free up.</p>
|
|
1697
|
+
<p>ℹ️ The tab list's <code>--tab-list-free-space</code> custom property has the same value (e.g. "120px").</p>
|
|
1698
|
+
<p>ℹ️ Within a tabset (e.g. its toolbar), the <code>useTabListFreeSpace</code> hook returns this value (and re-renders when it changes).</p>
|
|
1699
|
+
</td>
|
|
1700
|
+
</tr>
|
|
1701
|
+
<tr>
|
|
1702
|
+
<td>getTabListOverflow</td>
|
|
1703
|
+
<td><p>Ids of a tabset's tabs that are out of view (scrolled out of its tab list, which overflows), in the order they're shown;
|
|
1704
|
+
e.g. to list them in an overflow menu.</p>
|
|
1705
|
+
<p>ℹ️ The same array is returned until the tabs out of view change.
|
|
1706
|
+
Tabs that aren't rendered at all (e.g. hidden with <code>display: none</code>) aren't included.</p>
|
|
1707
|
+
<p>ℹ️ Within a tabset (e.g. its toolbar), the <code>useTabListOverflow</code> hook returns this value (and re-renders when it changes).</p>
|
|
1708
|
+
</td>
|
|
1709
|
+
</tr>
|
|
1710
|
+
<tr>
|
|
1711
|
+
<td>maximizeTabset</td>
|
|
1712
|
+
<td><p>Maximize a tabset, so that it covers the rest of the workspace.</p>
|
|
1713
|
+
<p>ℹ️ This has no effect on the only tabset in a workspace (the root), which already fills it, or on a floating tabset.
|
|
1714
|
+
A maximized tabset is restored if it becomes the only one (e.g. after the other tabsets are closed).</p>
|
|
1715
|
+
</td>
|
|
1716
|
+
</tr>
|
|
1717
|
+
<tr>
|
|
1718
|
+
<td>moveTab</td>
|
|
1719
|
+
<td><p>Move a tab to a position within a tabset's tab list, to a region of a tabset's content area,
|
|
1720
|
+
or to an <code>edge</code> of the workspace (in a new tabset beside all of the other tabsets).</p>
|
|
1721
|
+
<p>ℹ️ The <code>"left"</code> and <code>"right"</code> regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).</p>
|
|
1722
|
+
<p>ℹ️ Floating tabsets can't be split, so a tab moved to an edge region of one is added to it instead (like the <code>"center"</code> region).</p>
|
|
1723
|
+
</td>
|
|
1724
|
+
</tr>
|
|
1725
|
+
<tr>
|
|
1726
|
+
<td>moveTabset</td>
|
|
1727
|
+
<td><p>Move a tabset beside another tabset (by dropping it onto a region at the edge of that tabset's content area),
|
|
1728
|
+
or beside all of the other tabsets (at an <code>edge</code> of the workspace),
|
|
1729
|
+
or move its tabs into another tabset (at an <code>index</code> within its tab list, or onto the <code>"center"</code> of its content area).
|
|
1730
|
+
The <code>"left"</code> and <code>"right"</code> regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).</p>
|
|
1731
|
+
<p>ℹ️ When its tabs are moved, the emptied tabset is removed (unless it has the <code>keepWhenEmpty</code> flag).</p>
|
|
1732
|
+
<p>ℹ️ A floating tabset moved beside another tabset (or to an edge of the workspace) is docked: it's moved into the layout, and stops floating.
|
|
1733
|
+
Floating tabsets can't be split, so a tabset moved to an edge region of one has its tabs moved into it instead (like the <code>"center"</code> region).</p>
|
|
1734
|
+
</td>
|
|
1735
|
+
</tr>
|
|
1736
|
+
<tr>
|
|
1737
|
+
<td>restoreTabset</td>
|
|
1738
|
+
<td><p>Restore the maximized tabset (if there is one).</p>
|
|
1739
|
+
</td>
|
|
1740
|
+
</tr>
|
|
1741
|
+
<tr>
|
|
1742
|
+
<td>selectTab</td>
|
|
1743
|
+
<td><p>Select a tab within its tabset.</p>
|
|
1744
|
+
<p>ℹ️ Like a tab selected any other way, it's scrolled into view if its tab list overflows.</p>
|
|
1745
|
+
</td>
|
|
1746
|
+
</tr>
|
|
1747
|
+
<tr>
|
|
1748
|
+
<td>setModel</td>
|
|
1749
|
+
<td><p>Replace the model.</p>
|
|
1750
|
+
</td>
|
|
1751
|
+
</tr>
|
|
1752
|
+
<tr>
|
|
1753
|
+
<td>startExternalDrag</td>
|
|
1754
|
+
<td><p>Start dragging a tab that isn't in the workspace yet, from an element outside of it (e.g. an item in a palette of widgets);
|
|
1755
|
+
call it from the element's <code>pointerdown</code> handler.
|
|
1756
|
+
The tab is dragged like tabs within the workspace are (with the same drop targets, drop indicator, and <code>disableDrop</code> checks, with the <code>"new"</code> source),
|
|
1757
|
+
and is added where it's dropped (reported to <code>onModelChanged</code> with the <code>"add"</code> reason).
|
|
1758
|
+
The drag starts once the pointer has moved a few pixels, so a press that doesn't move (e.g. a click) does nothing;
|
|
1759
|
+
the click that follows a drag is suppressed. Pressing Escape cancels the drag.</p>
|
|
1760
|
+
<p>ℹ️ Unlike other imperative methods, the drop is restricted by <code>disabled</code> and <code>disableDrop</code>, since the user chooses where it goes.</p>
|
|
1761
|
+
<p>ℹ️ The element must be in the same document as the workspace.
|
|
1762
|
+
Like tabs, it should have <code>touch-action: none</code> (e.g. with CSS), so that touch input drags it rather than scrolling the page.</p>
|
|
1763
|
+
<ul>
|
|
1764
|
+
<li><code>event</code> The <code>pointerdown</code> event of the pressed element</li>
|
|
1765
|
+
</ul>
|
|
1766
|
+
</td>
|
|
1767
|
+
</tr>
|
|
1768
|
+
<tr>
|
|
1769
|
+
<td>subscribeToTabListFreeSpace</td>
|
|
1770
|
+
<td><p>Subscribe to changes to the free space in a tabset's tab list (see <code>getTabListFreeSpace</code>),
|
|
1771
|
+
e.g. from a toolbar rendered outside of the Workspace.</p>
|
|
1772
|
+
<p>ℹ️ The listener is called synchronously when the tab list is measured (when it or its tabs change size, or tabs are added or removed),
|
|
1773
|
+
before the browser paints; changes it makes to the DOM (e.g. with <code>flushSync</code>) are shown in the same frame.</p>
|
|
1774
|
+
<p>ℹ️ The listener is called with <code>undefined</code> when the tabset is removed (e.g. closed, or merged into another tabset).</p>
|
|
1775
|
+
</td>
|
|
1776
|
+
</tr>
|
|
1777
|
+
<tr>
|
|
1778
|
+
<td>subscribeToTabListOverflow</td>
|
|
1779
|
+
<td><p>Subscribe to changes to which of a tabset's tabs are out of view (see <code>getTabListOverflow</code>),
|
|
1780
|
+
e.g. from an overflow menu rendered outside of the Workspace.</p>
|
|
1781
|
+
<p>ℹ️ The listener is called synchronously when the tab list is measured (when it's scrolled, when it or its tabs change size, or when tabs are added or removed),
|
|
1782
|
+
before the browser paints, except while the user scrolls the list (it's reported in the scroll event, and the browser may show the new position first).</p>
|
|
1783
|
+
<p>ℹ️ The listener is called with <code>undefined</code> when the tabset is removed (e.g. closed, or merged into another tabset).</p>
|
|
1784
|
+
</td>
|
|
1785
|
+
</tr>
|
|
1786
|
+
<tr>
|
|
1787
|
+
<td>updateTab</td>
|
|
1788
|
+
<td><p>Update a tab; fields that are not specified are not changed.</p>
|
|
1789
|
+
<p>ℹ️ <code>data</code> is replaced rather than merged.</p>
|
|
1790
|
+
</td>
|
|
1791
|
+
</tr>
|
|
1792
|
+
<tr>
|
|
1793
|
+
<td>updateTabset</td>
|
|
1794
|
+
<td><p>Update a tabset; fields that are not specified are not changed.</p>
|
|
1795
|
+
<p>ℹ️ <code>data</code> is replaced rather than merged.</p>
|
|
1796
|
+
<p>ℹ️ Setting <code>minHeight</code>, <code>minWidth</code>, or <code>tabPlacement</code> to <code>undefined</code> removes the tabset's override,
|
|
1797
|
+
so the corresponding Workspace prop is used; setting <code>maxHeight</code> or <code>maxWidth</code> to <code>undefined</code> removes the maximum.</p>
|
|
1798
|
+
<p>ℹ️ The position and size (<code>x</code>, <code>y</code>, <code>width</code>, and <code>height</code>) of a floating tabset can be changed too (and are ignored for other tabsets),
|
|
1799
|
+
as can be its <code>collapsible</code> flag (which is ignored for floating tabsets).</p>
|
|
1228
1800
|
</td>
|
|
1229
1801
|
</tr>
|
|
1230
1802
|
</tbody>
|
|
1231
1803
|
</table>
|
|
1232
1804
|
|
|
1233
|
-
<!--
|
|
1805
|
+
<!-- react-lib-tools:api:end -->
|