Examples › RTL support
Mantine ContextMenu fully supports RTL (right-to-left) layouts, making it suitable for Arabic, Hebrew, Persian, and other RTL languages. The component automatically detects and adapts to the text direction when wrapped in Mantine's DirectionProvider.
How RTL support works
When using RTL mode, the context menu automatically adjusts:
- Menu positioning — The menu appears to the left of the cursor instead of the right, ensuring it stays within viewport bounds
- Text alignment — Text and content align to the right, following RTL reading direction
- Icon spacing — Icons are positioned on the correct side using logical CSS properties (
margin-inline-startandmargin-inline-end) - Submenu positioning — Submenus open to the left of their parent items, with properly positioned indicators
Setting up RTL
To enable RTL support, wrap your application (or the relevant section) in Mantine's DirectionProvider component. The context menu will automatically detect the direction using Mantine's useDirection hook:
The DirectionProvider (see Mantine DirectionProvider docs) sets the text direction for all Mantine components within its context. The context menu automatically reads this direction and adjusts its behavior accordingly.
Interactive example
Toggle the switch below to test RTL support. Try right-clicking at different positions (left, center, right edges of the image) to see how the menu intelligently positions itself. Notice how submenus open in the correct direction and all text, icons, and indicators are properly aligned:
Direction: LTR
Toggle to test RTL support

Picture by Daria Shatova
Here's the code for the above example: