View as Markdown

RTL

Right-to-left

RTL layout, keyboard and scrolling.

A grid inside a dir="rtl" ancestor, or with an explicit dir prop, renders right to left. dir takes 'ltr', 'rtl' or 'auto'; 'auto' follows the script of the grid locale, so locale="ar-EG" with dir="auto" is right to left (see Localization). Without dir the grid inherits the ancestor direction. All grid CSS uses logical properties, so the layout, alignment, indents and frozen zones mirror without RTL-specific styles. Arrow keys move in visual order: in RTL, ArrowLeft moves to the next column, and the pager arrow keys flip the same way. Horizontal scroll offsets are normalized across browsers, so column virtualization works in RTL.

In an RTL grid each body cell lays out its text with its own direction (unicode-bidi: plaintext), so a left-to-right value such as a German date ("1. März 2014") or an amount keeps its order instead of being reordered around the neutral characters, while Arabic or Hebrew text stays right to left; cells stay aligned to the grid's start side (and align: 'end' to its end side).

<DataGrid data={orders} columns={columns} locale="ar-EG" dir="auto" />

The resolved dir is computed from props alone (the 'auto' case from the locale string), so the server renders the same dir attribute the client hydrates with; an inherited direction needs no prop, since the logical CSS mirrors the server markup without script.

Pinned columns, resizing and reordering

Pinning is logical: pinned: 'start' and pinnedColumns.start pin to the right edge in RTL and 'end' to the left edge, so the same column definitions serve both directions. The resize handle sits on the column's end edge, the left edge in RTL; dragging it to the left widens the column, and the keyboard resize keys on a focused header (Ctrl+Alt+ArrowLeft, Ctrl+Alt+ArrowRight) follow the visual direction, as do the reorder keys (Alt+ArrowLeft, Alt+ArrowRight). While a header is dragged, the drop indicator and the drag preview are positioned from the logical start, so they track the pointer in either direction. onColumnResizeEnd and onColumnReorder report the same widths and visible indices as in LTR.

Right-to-left

Open demo

An RTL grid with 30 virtualized columns - mirrored layout and pinned zones, flipped arrow keys, mirrored resize handles and drag indicators, and normalized horizontal scrolling.

#
Value 1
Value 2
Text 3
Value 4
Value 5
Text 6
Value 7
Value 8
Text 9
Value 10
Value 11
Text 12
Value 13
Value 14
Text 15
Value 16
Value 17
Text 18
Value 19
Value 20
Value 29
0
17,595
73,603
india-0
89,904
53,726
juliet-0
51,543
54,681
bravo-0
68,199
6,896
juliet-0
8,919
42,947
alpha-0
29,833
3,953
charlie-0
59,401
63,905
45,558
1
19,690
76,900
golf-1
63,257
93,463
charlie-1
73,180
76,755
delta-1
66,097
4,541
bravo-1
17,543
8,514
echo-1
35,140
25,990
juliet-1
39,531
65,365
2,231
2
59,295
35,017
charlie-2
9,491
78,361
echo-2
97,760
84,967
charlie-2
33,456
62,943
alpha-2
96,517
65,225
foxtrot-2
22,349
49,286
charlie-2
6,173
83,247
17,251
3
35,877
55,968
alpha-3
7,608
53,800
foxtrot-3
23,732
38,972
charlie-3
25,902
12,898
echo-3
46,117
4,168
alpha-3
52,853
77,546
alpha-3
86,219
88,457
74,020
4
34,311
61,050
hotel-4
22,377
63,353
bravo-4
74,018
13,961
india-4
56,331
42,367
foxtrot-4
45,663
88,442
charlie-4
55,558
63,841
juliet-4
44,597
75,320
5,355
5
91,410
88,735
india-5
4,726
46,755
foxtrot-5
18,912
53,583
foxtrot-5
52,092
75,215
india-5
37,385
87,851
charlie-5
65,715
66,738
charlie-5
57,729
35,326
75,235
6
19,681
45,767
juliet-6
81,684
43,403
delta-6
67,496
63,555
hotel-6
84,296
25,267
charlie-6
32,699
84,878
juliet-6
90,775
18,986
charlie-6
26,037
76,307
79,865
7
54,528
24,961
bravo-7
38,898
11,936
bravo-7
24,376
70,956
india-7
13,850
376
foxtrot-7
21,286
80,591
foxtrot-7
29,490
66,515
hotel-7
56,516
86,920
65,328
8
60,869
8,446
charlie-8
75,901
69,947
juliet-8
51,390
69,049
juliet-8
56,014
71,245
charlie-8
72,266
55,207
india-8
6,795
52,120
charlie-8
8,427
49,252
74,001
9
75,855
9,597
alpha-9
47,126
22,101
foxtrot-9
88,095
69,323
hotel-9
28,224
13,727
bravo-9
50,639
78,507
india-9
34,637
37,497
foxtrot-9
1,229
89,758
33,877
10
58,099
68,722
bravo-10
13,363
50,105
charlie-10
8,700
37,059
delta-10
89,294
81,549
bravo-10
14,399
84
delta-10
41,206
1,699
delta-10
28,123
67,158
93,255
11
44,095
65,059
charlie-11
27,571
63,118
echo-11
76,276
46,620
charlie-11
85,845
43,610
echo-11
61,207
22,517
india-11
52,089
96,035
hotel-11
79,839
84,378
75,398
12
87,775
14,793
echo-12
53,666
21,185
charlie-12
71,766
90,493
charlie-12
81,970
56,085
golf-12
76,381
86,883
india-12
50,433
28,788
golf-12
43,415
61,725
16,903
13
11,378
92,348
juliet-13
50,530
91,535
foxtrot-13
46,779
58,126
hotel-13
74,472
75,706
delta-13
20,782
93,092
foxtrot-13
59,582
68,970
charlie-13
24,546
31,363
26,748
14
50,747
60,702
delta-14
13,751
21,341
india-14
404
12,918
foxtrot-14
31,446
39,169
foxtrot-14
80,323
80,536
foxtrot-14
74,750
82,895
foxtrot-14
70,528
9,434
42,607
15
66,303
27,174
foxtrot-15
15,685
41,810
charlie-15
63,343
80,874
echo-15
15,679
9,656
hotel-15
39,314
48,146
bravo-15
39,322
69,568
hotel-15
5,880
82,519
15,886
16
96,820
6,701
foxtrot-16
19,607
7,853
alpha-16
71,448
63,714
echo-16
38,877
60,995
delta-16
5,792
75,559
juliet-16
73,833
86,485
india-16
32,670
34,075
98,289
17
60,534
72,931
alpha-17
68,578
91,404
charlie-17
32,260
45,307
foxtrot-17
93,320
87,659
alpha-17
29,270
59,959
alpha-17
439
77,734
alpha-17
33,653
1,898
43,295
18
91,214
23,934
india-18
51,017
88,074
echo-18
67,009
27,532
hotel-18
78,073
35,746
juliet-18
8,896
53,619
charlie-18
48,670
26,279
hotel-18
88,194
66,282
23,400
19
31,831
70,702
juliet-19
96,175
27,610
india-19
96,357
50,732
india-19
87,297
19,078
delta-19
49,402
72,108
bravo-19
918
73,850
juliet-19
33,098
58,477
57,014
No events yet.

API reference

dir is documented on DataGridProps.