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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    3,914
    • latest

Version History

Package Sidebar

Install

npm i use-lang-direction

Weekly Downloads

3,586

Version

0.2.0

License

MIT

Unpacked Size

8.04 kB

Total Files

4

Last publish

Collaborators

  • davidicus