Skip to content

Instantly share code, notes, and snippets.

@chadmuro
Created September 16, 2021 22:51
Show Gist options
  • Save chadmuro/2a923719173a6113980aeb29ca2f754a to your computer and use it in GitHub Desktop.
Save chadmuro/2a923719173a6113980aeb29ca2f754a to your computer and use it in GitHub Desktop.
MUI sx prop
import * as React from 'react';
import TrendingUpIcon from '@mui/icons-material/TrendingUp';
import { Box } from '@mui/system';
export default function Example() {
return (
<Box
sx={{
bgcolor: 'background.paper',
boxShadow: 1,
borderRadius: 1,
p: 2,
minWidth: 300,
}}
>
<Box sx={{ color: 'text.secondary' }}>Sessions</Box>
<Box sx={{ color: 'text.primary', fontSize: 34, fontWeight: 'medium' }}>
98.3 K
</Box>
<TrendingUpIcon
sx={{ color: 'success.dark', fontSize: 16, verticalAlign: 'sub' }}
/>
<Box
sx={{
color: 'success.dark',
display: 'inline',
fontWeight: 'medium',
mx: 0.5,
}}
>
18.77%
</Box>
<Box sx={{ color: 'text.secondary', display: 'inline', fontSize: 12 }}>
vs. last week
</Box>
</Box>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment