use-lang-direction

0.2.0 • Public • Published

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

Package Sidebar

Install

npm i use-lang-direction

Weekly Downloads

2,088

Version

0.2.0

License

MIT

Unpacked Size

8.04 kB

Total Files

4

Last publish

Collaborators

  • davidicus