Skip to content

rtl

Returns true if the HTML or body element has either the “dir” HTML attribute or the “direction” CSS property set to “rtl”.

True when the document is right-to-left, judged by the dir attribute or the computed direction of <html> or <body>. Charts read it to mirror legends, timelines, and text alignment. Tick the box to flip this page and watch the value change.

import {rtl} from "@d3plus/dom";

rtl();
document.body.dir = "rtl";
rtl();

Parameters

import {rtl} from "@d3plus/dom";

Takes no parameters.