@mui/material/styles#styled JavaScript Examples
The following examples show how to use
@mui/material/styles#styled.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Scrollbar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
SimpleBarStyle = styled(SimpleBarReact)(({ theme }) => ({
maxHeight: '100%',
'& .simplebar-scrollbar': {
'&:before': {
backgroundColor: alpha(theme.palette.grey[600], 0.48),
},
'&.simplebar-visible:before': {
opacity: 1,
},
},
'& .simplebar-track.simplebar-vertical': {
width: 10,
},
'& .simplebar-track.simplebar-horizontal .simplebar-scrollbar': {
height: 6,
},
'& .simplebar-mask': {
zIndex: 'inherit',
},
}))
Example #2
Source File: Login.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
HeaderStyle = styled('header')(({ theme }) => ({
top: 0,
zIndex: 9,
lineHeight: 0,
width: '100%',
display: 'flex',
alignItems: 'center',
position: 'absolute',
padding: theme.spacing(3),
justifyContent: 'space-between',
[theme.breakpoints.up('md')]: {
alignItems: 'flex-start',
padding: theme.spacing(7, 5, 0, 7),
},
}))
Example #3
Source File: Login.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
ContentStyle = styled('div')(({ theme }) => ({
maxWidth: 480,
margin: 'auto',
minHeight: '100vh',
display: 'flex',
justifyContent: 'center',
flexDirection: 'column',
padding: theme.spacing(12, 0),
}))
Example #4
Source File: index.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
MainStyle = styled('div')(({ theme }) => ({
flexGrow: 1,
overflow: 'auto',
minHeight: '100%',
paddingTop: APP_BAR_MOBILE + 24,
paddingBottom: theme.spacing(10),
[theme.breakpoints.up('lg')]: {
paddingTop: APP_BAR_DESKTOP + 24,
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2)
}
}))
Example #5
Source File: Page404.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
ContentStyle = styled('div')(({ theme }) => ({
maxWidth: 480,
margin: 'auto',
minHeight: '100vh',
display: 'flex',
justifyContent: 'center',
flexDirection: 'column',
padding: theme.spacing(12, 0)
}))
Example #6
Source File: Searchbar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
SearchbarStyle = styled('div')(({ theme }) => ({
top: 0,
left: 0,
zIndex: 99,
width: '100%',
display: 'flex',
position: 'absolute',
alignItems: 'center',
height: APPBAR_MOBILE,
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)', // Fix on Mobile
padding: theme.spacing(0, 3),
boxShadow: theme.customShadows.z8,
backgroundColor: `${alpha(theme.palette.background.default, 0.72)}`,
[theme.breakpoints.up('md')]: {
height: APPBAR_DESKTOP,
padding: theme.spacing(0, 5),
},
}))
Example #7
Source File: Register.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
HeaderStyle = styled('header')(({ theme }) => ({
top: 0,
zIndex: 9,
lineHeight: 0,
width: '100%',
display: 'flex',
alignItems: 'center',
position: 'absolute',
padding: theme.spacing(3),
justifyContent: 'space-between',
[theme.breakpoints.up('md')]: {
alignItems: 'flex-start',
padding: theme.spacing(7, 5, 0, 7),
},
}))
Example #8
Source File: DashboardNavbar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
RootStyle = styled(AppBar)(({ theme }) => ({
boxShadow: 'none',
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)', // Fix on Mobile
backgroundColor: alpha(theme.palette.background.default, 0.72),
[theme.breakpoints.up('lg')]: {
width: `calc(100% - ${DRAWER_WIDTH + 1}px)`,
},
}))
Example #9
Source File: LogoOnlyLayout.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
HeaderStyle = styled('header')(({ theme }) => ({
top: 0,
left: 0,
lineHeight: 0,
width: '100%',
position: 'absolute',
padding: theme.spacing(3, 3, 0),
[theme.breakpoints.up('sm')]: {
padding: theme.spacing(5, 5, 0),
},
}))
Example #10
Source File: Register.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
ContentStyle = styled('div')(({ theme }) => ({
maxWidth: 480,
margin: 'auto',
minHeight: '100vh',
display: 'flex',
justifyContent: 'center',
flexDirection: 'column',
padding: theme.spacing(12, 0),
}))
Example #11
Source File: UserListToolbar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
SearchStyle = styled(OutlinedInput)(({ theme }) => ({
width: 240,
transition: theme.transitions.create(['box-shadow', 'width'], {
easing: theme.transitions.easing.easeInOut,
duration: theme.transitions.duration.shorter,
}),
'&.Mui-focused': { width: 320, boxShadow: theme.customShadows.z8 },
'& fieldset': {
borderWidth: `1px !important`,
borderColor: `${theme.palette.grey[500_32]} !important`,
},
}))
Example #12
Source File: CustomizedSwitch.jsx From matx-react with MIT License | 6 votes |
Android12Switch = styled(Switch)(({ theme }) => ({
padding: 8,
"& .MuiSwitch-track": {
borderRadius: 22 / 2,
"&:before, &:after": {
content: '""',
position: "absolute",
top: "50%",
transform: "translateY(-50%)",
width: 16,
height: 16,
},
"&:before": {
backgroundImage: `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 24 24"><path fill="${encodeURIComponent(
theme.palette.getContrastText(theme.palette.primary.main)
)}" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"/></svg>')`,
left: 12,
},
"&:after": {
backgroundImage: `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 24 24"><path fill="${encodeURIComponent(
theme.palette.getContrastText(theme.palette.primary.main)
)}" d="M19,13H5V11H19V13Z" /></svg>')`,
right: 12,
},
},
"& .MuiSwitch-thumb": {
boxShadow: "none",
width: 16,
height: 16,
margin: 2,
},
}))
Example #13
Source File: MenuPopover.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
ArrowStyle = styled('span')(({ theme }) => ({
[theme.breakpoints.up('sm')]: {
top: -7,
zIndex: 1,
width: 12,
right: 20,
height: 12,
content: "''",
position: 'absolute',
borderRadius: '0 0 4px 0',
transform: 'rotate(-135deg)',
background: theme.palette.background.paper,
borderRight: `solid 1px ${alpha(theme.palette.grey[500], 0.12)}`,
borderBottom: `solid 1px ${alpha(theme.palette.grey[500], 0.12)}`,
},
}))
Example #14
Source File: index.js From fireact with MIT License | 6 votes |
Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
({ theme, open }) => ({
width: drawerWidth,
flexShrink: 0,
whiteSpace: 'nowrap',
boxSizing: 'border-box',
...(open && {
...openedMixin(theme),
'& .MuiDrawer-paper': openedMixin(theme),
}),
...(!open && {
...closedMixin(theme),
'& .MuiDrawer-paper': closedMixin(theme),
}),
}),
)
Example #15
Source File: index.js From fireact with MIT License | 6 votes |
AppBar = styled(MuiAppBar, {
shouldForwardProp: (prop) => prop !== 'open',
})(({ theme, open }) => ({
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
...(open && {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
}),
}))
Example #16
Source File: Header.jsx From hr-atx58-fec-havarti with Mozilla Public License 2.0 | 6 votes |
Search = styled('div')(({ theme }) => ({
position: 'relative',
borderRadius: theme.shape.borderRadius,
backgroundColor: alpha(theme.palette.common.white, 0.15),
'&:hover': {
backgroundColor: alpha(theme.palette.common.white, 0.25),
},
marginLeft: 0,
width: '100%',
[theme.breakpoints.up('sm')]: {
marginLeft: theme.spacing(1),
width: 'auto',
},
}))
Example #17
Source File: LoginForm.js From react-admin-amplify-demo with MIT License | 6 votes |
StyledForm = styled(Form, {
name: PREFIX,
overridesResolver: (props, styles) => styles.root,
})(({ theme }) => ({
[`& .${LoginFormClasses.content}`]: {
width: 300,
},
[`& .${LoginFormClasses.button}`]: {
marginTop: theme.spacing(2),
},
[`& .${LoginFormClasses.icon}`]: {
margin: theme.spacing(0.3),
},
}))
Example #18
Source File: Header.jsx From hr-atx58-fec-havarti with Mozilla Public License 2.0 | 6 votes |
StyledInputBase = styled(InputBase)(({ theme }) => ({
color: 'inherit',
'& .MuiInputBase-input': {
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)})`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('sm')]: {
width: '12ch',
'&:focus': {
width: '20ch',
},
},
},
}))
Example #19
Source File: Header.jsx From hr-atx58-fec-havarti with Mozilla Public License 2.0 | 6 votes |
SearchIconWrapper = styled('div')(({ theme }) => ({
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}))
Example #20
Source File: CustomizedSwitch.jsx From matx-react with MIT License | 5 votes |
MaterialUISwitch = styled(Switch)(({ theme }) => ({
width: 62,
height: 34,
padding: 7,
"& .MuiSwitch-switchBase": {
margin: 1,
padding: 0,
transform: "translateX(6px)",
"&.Mui-checked": {
color: "#fff",
transform: "translateX(22px)",
"& .MuiSwitch-thumb:before": {
backgroundImage: `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 20 20"><path fill="${encodeURIComponent(
"#fff"
)}" d="M4.2 2.5l-.7 1.8-1.8.7 1.8.7.7 1.8.6-1.8L6.7 5l-1.9-.7-.6-1.8zm15 8.3a6.7 6.7 0 11-6.6-6.6 5.8 5.8 0 006.6 6.6z"/></svg>')`,
},
"& + .MuiSwitch-track": {
opacity: 1,
backgroundColor: theme.palette.mode === "dark" ? "#8796A5" : "#aab4be",
},
},
},
"& .MuiSwitch-thumb": {
backgroundColor: theme.palette.mode === "dark" ? "#003892" : "#001e3c",
width: 32,
height: 32,
"&:before": {
content: "''",
position: "absolute",
width: "100%",
height: "100%",
left: 0,
top: 0,
backgroundRepeat: "no-repeat",
backgroundPosition: "center",
backgroundImage: `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 20 20"><path fill="${encodeURIComponent(
"#fff"
)}" d="M9.305 1.667V3.75h1.389V1.667h-1.39zm-4.707 1.95l-.982.982L5.09 6.072l.982-.982-1.473-1.473zm10.802 0L13.927 5.09l.982.982 1.473-1.473-.982-.982zM10 5.139a4.872 4.872 0 00-4.862 4.86A4.872 4.872 0 0010 14.862 4.872 4.872 0 0014.86 10 4.872 4.872 0 0010 5.139zm0 1.389A3.462 3.462 0 0113.471 10a3.462 3.462 0 01-3.473 3.472A3.462 3.462 0 016.527 10 3.462 3.462 0 0110 6.528zM1.665 9.305v1.39h2.083v-1.39H1.666zm14.583 0v1.39h2.084v-1.39h-2.084zM5.09 13.928L3.616 15.4l.982.982 1.473-1.473-.982-.982zm9.82 0l-.982.982 1.473 1.473.982-.982-1.473-1.473zM9.305 16.25v2.083h1.389V16.25h-1.39z"/></svg>')`,
},
},
"& .MuiSwitch-track": {
opacity: 1,
backgroundColor: theme.palette.mode === "dark" ? "#8796A5" : "#aab4be",
borderRadius: 20 / 2,
},
}))
Example #21
Source File: CustomizedSwitch.jsx From matx-react with MIT License | 5 votes |
AntSwitch = styled(Switch)(({ theme }) => ({
width: 28,
height: 16,
padding: 0,
display: "flex",
"&:active": {
"& .MuiSwitch-thumb": {
width: 15,
},
"& .MuiSwitch-switchBase.Mui-checked": {
transform: "translateX(9px)",
},
},
"& .MuiSwitch-switchBase": {
padding: 2,
"&.Mui-checked": {
transform: "translateX(12px)",
color: "#fff",
"& + .MuiSwitch-track": {
opacity: 1,
backgroundColor: theme.palette.mode === "dark" ? "#177ddc" : "#1890ff",
},
},
},
"& .MuiSwitch-thumb": {
boxShadow: "0 2px 4px 0 rgb(0 35 11 / 20%)",
width: 12,
height: 12,
borderRadius: 6,
transition: theme.transitions.create(["width"], {
duration: 200,
}),
},
"& .MuiSwitch-track": {
borderRadius: 16 / 2,
opacity: 1,
backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,.35)" : "rgba(0,0,0,.25)",
boxSizing: "border-box",
},
}))
Example #22
Source File: UserListToolbar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
RootStyle = styled(Toolbar)(({ theme }) => ({
height: 96,
display: 'flex',
justifyContent: 'space-between',
padding: theme.spacing(0, 1, 0, 3),
}))
Example #23
Source File: CustomizedSwitch.jsx From matx-react with MIT License | 5 votes |
IOSSwitch = styled((props) => (
<Switch focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} />
))(({ theme }) => ({
width: 42,
height: 26,
padding: 0,
"& .MuiSwitch-switchBase": {
padding: 0,
margin: 2,
transitionDuration: "300ms",
"&.Mui-checked": {
transform: "translateX(16px)",
color: "#fff",
"& + .MuiSwitch-track": {
backgroundColor: theme.palette.mode === "dark" ? "#2ECA45" : "#65C466",
opacity: 1,
border: 0,
},
"&.Mui-disabled + .MuiSwitch-track": {
opacity: 0.5,
},
},
"&.Mui-focusVisible .MuiSwitch-thumb": {
color: "#33cf4d",
border: "6px solid #fff",
},
"&.Mui-disabled .MuiSwitch-thumb": {
color: theme.palette.mode === "light" ? theme.palette.grey[100] : theme.palette.grey[600],
},
"&.Mui-disabled + .MuiSwitch-track": {
opacity: theme.palette.mode === "light" ? 0.7 : 0.3,
},
},
"& .MuiSwitch-thumb": {
boxSizing: "border-box",
width: 22,
height: 22,
},
"& .MuiSwitch-track": {
borderRadius: 26 / 2,
backgroundColor: theme.palette.mode === "light" ? "#E9E9EA" : "#39393D",
opacity: 1,
transition: theme.transitions.create(["background-color"], {
duration: 500,
}),
},
}))
Example #24
Source File: Register.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
SectionStyle = styled(Card)(({ theme }) => ({
width: '100%',
maxWidth: 464,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
margin: theme.spacing(2, 0, 2, 2),
}))
Example #25
Source File: Register.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
RootStyle = styled('div')(({ theme }) => ({
[theme.breakpoints.up('md')]: {
display: 'flex',
},
}))
Example #26
Source File: Login.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
SectionStyle = styled(Card)(({ theme }) => ({
width: '100%',
maxWidth: 464,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
margin: theme.spacing(2, 0, 2, 2),
}))
Example #27
Source File: Login.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
RootStyle = styled('div')(({ theme }) => ({
[theme.breakpoints.up('md')]: {
display: 'flex',
},
}))
Example #28
Source File: index.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
RootStyle = styled('div')({
display: 'flex',
minHeight: '100%',
overflow: 'hidden'
})
Example #29
Source File: DashboardSidebar.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
AccountStyle = styled('div')(({ theme }) => ({
display: 'flex',
alignItems: 'center',
padding: theme.spacing(2, 2.5),
borderRadius: Number(theme.shape.borderRadius) * 1.5,
backgroundColor: theme.palette.grey[500_12],
}))