@mui/material#SxProps TypeScript Examples

The following examples show how to use @mui/material#SxProps. 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: index.tsx    From tams-club-cal with MIT License 6 votes vote down vote up
listTextFormat = {
    marginTop: 3,
    marginBottom: 8,
    textAlign: 'center',
    color: (theme) => darkSwitchGrey(theme),
} as SxProps<Theme>
Example #2
Source File: ContextMenu.tsx    From multi-downloader-nx with MIT License 6 votes vote down vote up
buttonSx: SxProps = {
  '&:hover': {
    background: 'rgb(0, 30, 60)'
  },
  fontSize: '0.7rem',
  minHeight: '30px',
  justifyContent: 'center',
  p: 0
}
Example #3
Source File: Image.tsx    From mui-toolpad with MIT License 6 votes vote down vote up
function Image({ sx: sxProp, src, width, height, alt, loading: loadingProp, fit }: ImageProps) {
  const sx: SxProps = React.useMemo(
    () => ({
      ...sxProp,
      width,
      height,
      position: 'relative',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
    }),
    [sxProp, width, height],
  );

  const [imgLoading, setImgLoading] = React.useState(true);
  const handleLoad = React.useCallback(() => setImgLoading(false), []);

  const loading = loadingProp || imgLoading;

  return (
    <Box sx={sx}>
      {loading ? <Skeleton variant="rectangular" width={width} height={height} /> : null}
      <Box
        component="img"
        src={src}
        alt={alt}
        sx={{
          width: '100%',
          height: '100%',
          objectFit: fit,
          position: 'absolute',
          visibility: loading ? 'hidden' : 'visible',
        }}
        onLoad={handleLoad}
      />
    </Box>
  );
}
Example #4
Source File: DetailsDialog.tsx    From frontend with MIT License 5 votes vote down vote up
containerStyles: SxProps<Theme> = {
  position: 'absolute' as const,
  top: 0,
  left: 0,
  width: '100vw',
  height: '100vh',
  p: 4,
}