score:2
Accepted answer
You need jss-rtl
to support rtl for css. This library provides its Provider
to support rtl in any library.
import React from "react";
import { create } from "jss";
import rtl from "jss-rtl";
import JssProvider from "react-jss/lib/JssProvider";
import { createGenerateClassName, jssPreset } from "@material-ui/core/styles";
// Configure JSS
const jss = create({ plugins: [...jssPreset().plugins, rtl()] });
// Custom Material-UI class name generator.
const generateClassName = createGenerateClassName();
function RTL(props) {
return (
<JssProvider jss={jss} generateClassName={generateClassName}>
{props.children}
</JssProvider>
);
}
export default RTL;
Then in your main app use this provider.
ReactDOM.render(
<RTL>
<Demo />
</RTL>,
document.querySelector("#root")
);
Working demo here
Source: stackoverflow.com
Related Query
- How to get the label in the material-ui text field to the right?
- How to fix placeholder text within the input in material ui text field
- How can we get the text field value during onSubmit method in latest react-hooks-form
- How to get the text inside a label tag on a click event in ReactJs?
- How to clear the text field in formsy material ui React
- How to get label text instead of the value of the antd slider
- How do i get the value of text input field using react
- How can I give an empty material UI text field a value of null, when submitting the form, instead of an empty string?
- Material Text field label get cut when reload page
- How to get the field values in react material ui components
- How to get the label and values from multiple TextArea material ui with same onchange function for all?
- How to keep the text cursor inside an html input field to the right while the user is writing?
- How to get the value of an input field using ReactJS?
- material UI - How can I change the font size of the label in FormControlLabel
- How to change the text color of the selected row in material ui table
- Material UI | How to change the font colour of a disabled input text field?
- How can I change the label size of a material ui TextField?
- How do you position Material UI Popper in the bottom right corner of the browser?
- MaterialUI how to align text inside an Input to the right or center?
- How to get the selected text from text area in react?
- Material UI - Replicating the "required" text field error message
- clear the material UI text field Value in react
- How to get the name of Material UI 'Autocomplete' component?
- How to get the length of the text inside the React component
- Material UI Stepper using custom icon deletes the step number. how to add the number or random text back with a custom icon?
- How to format the text of the choices in a ReferenceInput field in react-admin?
- How do I pass the text data from firestore inside the expandable row and get the document ID to be passed inside the setState?
- How to get the label of dropdown in react?
- How to put text inside ListItem on the right side?
- How to position expand icon on the right side of the accordion while keeping the text in the center?
More Query from same tag
- Implementing useMemo the right way
- How does one pass a prop as null in react?
- State not updating when receiving new props (ReactJS)
- Not able to align divs' inside a parent div in react
- App is not defined -undef ... starting new in react
- How can I search for a component with specific key in React Developer Tools?
- VS Code settings to launch frontend and backend for debug
- changing video source in useEffect based on language change
- react-photo-gallery don't change photos via state
- Why getting cannot read properties of undefined error?
- How to fix "404" error when directly accessing a component in react
- Setting react state the right way
- React router - useOutletContext testing
- webpack error in missing path @ multi main
- State not applied as expected when fetching data from API
- How can i clear my input when i'm submit my event (reactJs app)
- React Router 6.2.2. issue
- You may need an appropriate loader to handle this file type. with webpack
- TypeError: Cannot read property 'key' of undefined
- Why is html not printing on button click in reactjs?
- dynamic Progress bar in React
- react component is no updateing the view after deleting an item
- React ag-grid row auto height doesn't work
- React - SyntaxError: Unexpected token, expected for the AND operator in a stateless component
- How to redirect page on login using react-router-dom V5
- Arrow function without curly braces
- React-Horizontal-Timeline: How to only display "year" label using getLabel
- Block sending requests twice react-redux (hooks)
- How to toggle different css class on button in React?
- How to add element with props in react router V6