UNPKG

bits-ui

Version:

The headless components for Svelte.

10 lines (9 loc) 324 B
/** * Detects the text direction in the element. * @returns {Direction} The text direction ('ltr' for left-to-right or 'rtl' for right-to-left). */ export function getElemDirection(elem) { const style = window.getComputedStyle(elem); const direction = style.getPropertyValue("direction"); return direction; }