Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
import TextField from '@mui/material/TextField';
|
|
import rtlPlugin from '@mui/stylis-plugin-rtl';
|
|
import { prefixer } from 'stylis';
|
|
import { CacheProvider } from '@emotion/react';
|
|
import createCache from '@emotion/cache';
|
|
|
|
// Consuming the outer theme is only required with coexisting themes, like in this documentation.
|
|
// If your app/website doesn't deal with this, you can have just:
|
|
// const theme = createTheme({ direction: 'rtl' })
|
|
const theme = (outerTheme) =>
|
|
createTheme({
|
|
direction: 'rtl',
|
|
palette: {
|
|
mode: outerTheme.palette.mode,
|
|
},
|
|
});
|
|
|
|
const cacheRtl = createCache({
|
|
key: 'muirtl',
|
|
stylisPlugins: [prefixer, rtlPlugin],
|
|
});
|
|
|
|
export default function RtlDemo() {
|
|
return (
|
|
<CacheProvider value={cacheRtl}>
|
|
<ThemeProvider theme={theme}>
|
|
<div dir="rtl">
|
|
<TextField
|
|
label="ملصق"
|
|
placeholder="العنصر النائب"
|
|
helperText="هذا نص مساعد"
|
|
variant="outlined"
|
|
/>
|
|
</div>
|
|
</ThemeProvider>
|
|
</CacheProvider>
|
|
);
|
|
}
|