useTextDirection ​
browser
test coverage
Last changed: 24 days ago
Hook that can get and set the direction of the element
typescript
import { useTextDirection } from '@siberiacancode/reactuse';
Usage ​
typescript
const { value, set, remove } = useTextDirection(ref);
// or
const { ref, value, set, remove } = useTextDirection();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | HookTarget | - | The target element to observe |
initialValue? | UseTextDirectionValue | 'ltr' | The initial direction of the element |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
initialValue? | UseTextDirectionValue | 'ltr' | The initial direction of the element |