0.2.0 • Published 2 years ago

use-lang-direction v0.2.0

Weekly downloads
2,171
License
MIT
Repository
github
Last release
2 years ago

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