use-lang-direction

A React hook that reads an element's dir attribute value and any updates to that value

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
use-lang-direction
0160.2.0a year ago3 years agoMinified + gzip package size for use-lang-direction in KB

Readme

use-lang-direction
A React hook that reads the HTML element's dir attribute value and any updates to that value allowing you to update your UI accordingly.

In Action

CodeSandbox Demo

Basic Usage

import React from "react";
import { useLangDirection } from "use-lang-direction";

const App = () => {
  const langDir = useLangDirection();

  return (
    <div >
      <input dir={langDir} type="text" />
    </div>
  );
};

License

MIT