You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
300 B
TypeScript
12 lines
300 B
TypeScript
// RTL Support
|
|
|
|
export type HTMLDirection = 'ltr' | 'rtl';
|
|
|
|
export function isRtlBody(): boolean {
|
|
const body = document.getElementsByTagName('body').item(0);
|
|
|
|
return body?.classList.contains('rtl') || false;
|
|
}
|
|
|
|
export const useHTMLDirection = (): HTMLDirection => (isRtlBody() ? 'rtl' : 'ltr');
|