Keyboard and Accessibility
RTL Support
Enable Right-to-Left (RTL) rendering in LyteNyte Grid with a single configuration change.
LyteNyte Grid fully supports Right-to-Left (RTL) rendering.
Enable it by setting the rtl
property on the grid state.
LyteNyte Grid uses logical CSS properties
throughout its codebase. This ensures RTL works seamlessly without extra styling changes.
You only need to set the rtl
flag-no additional configuration is required.
Set the rtl
flag directly on the grid. The grid will not detect RTL
based on the CSS direction
of the viewport or any parent element.
RTL Mode
"use client";import { Grid, useClientRowDataSource } from "@1771technologies/lytenyte-pro";import "@1771technologies/lytenyte-pro/grid.css";import type { Column } from "@1771technologies/lytenyte-pro/types";import { bankDataSmall } from "@1771technologies/sample-data/bank-data-smaller";import { useId } from "react";type BankData = (typeof bankDataSmall)[number];const columns: Column<BankData>[] = [{ id: "age", type: "number" },{ id: "job" },{ id: "balance", type: "number" },{ id: "education" },{ id: "marital" },{ id: "default" },{ id: "housing" },{ id: "loan" },{ id: "contact" },{ id: "day", type: "number" },{ id: "month" },{ id: "duration" },{ id: "campaign" },{ id: "pdays" },{ id: "previous" },{ id: "poutcome" },{ id: "y" },];export default function RTLMode() {const ds = useClientRowDataSource({ data: bankDataSmall });const grid = Grid.useLyteNyte({gridId: useId(),rowDataSource: ds,columns,rtl: true,});const view = grid.view.useValue();return (<div><div className="px-2 py-2"><buttonclassName="rounded border border-gray-600 bg-gray-900 px-2 text-white dark:text-black"onClick={() => grid.state.rtl.set((prev) => !prev)}>Toggle RTL</button></div><div className="lng-grid" style={{ height: 500 }}><Grid.Root grid={grid}><Grid.Viewport><Grid.Header>{view.header.layout.map((row, i) => {return (<Grid.HeaderRow key={i} headerRowIndex={i}>{row.map((c) => {if (c.kind === "group") return null;return (<Grid.HeaderCellkey={c.id}cell={c}className="flex h-full w-full items-center px-2 capitalize"/>);})}</Grid.HeaderRow>);})}</Grid.Header><Grid.RowsContainer><Grid.RowsTop>{view.rows.top.map((row) => {if (row.kind === "full-width") return null;return (<Grid.Row row={row} key={row.id}>{row.cells.map((c) => {return (<Grid.Cellkey={c.id}cell={c}className="flex h-full w-full items-center px-2 text-sm"/>);})}</Grid.Row>);})}</Grid.RowsTop><Grid.RowsCenter>{view.rows.center.map((row) => {if (row.kind === "full-width") return null;return (<Grid.Row row={row} key={row.id}>{row.cells.map((c) => {return (<Grid.Cellkey={c.id}cell={c}className="flex h-full w-full items-center px-2 text-sm"/>);})}</Grid.Row>);})}</Grid.RowsCenter><Grid.RowsBottom>{view.rows.bottom.map((row) => {if (row.kind === "full-width") return null;return (<Grid.Row row={row} key={row.id}>{row.cells.map((c) => {return (<Grid.Cellkey={c.id}cell={c}className="flex h-full w-full items-center px-2 text-sm"/>);})}</Grid.Row>);})}</Grid.RowsBottom></Grid.RowsContainer></Grid.Viewport></Grid.Root></div></div>);}