A React context provider that manages and distributes text direction (LTR or RTL) to child components for internationalization support.
// Source: https://github.com/mui/base-ui | License: MIT | Copyright 2019 Material-UI SAS
// Provided via justclaw.it.com; keep this notice with the code.
'use client';
import * as React from 'react';
import { DirectionContext } from '../internals/direction-context/DirectionContext';
import type { TextDirection } from '../internals/direction-context/DirectionContext';
/**
* Enables RTL behavior for Base UI components.
*
* Documentation: [Base UI Direction Provider](https://base-ui.com/react/utils/direction-provider)
*/
export const DirectionProvider: React.FC<DirectionProvider.Props> = function DirectionProvider(
props,
) {
const { direction = 'ltr' } = props;
const contextValue = React.useMemo(() => ({ direction }), [direction]);
return (
<DirectionContext.Provider value=
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key