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
22 lines
561 B
TypeScript
22 lines
561 B
TypeScript
import styled, { ThemeProvider, StyleFunction } from 'styled-components';
|
|
import { unstable_styleFunctionSx, SxProps } from '@mui/system';
|
|
import { createTheme } from '@mui/material/styles';
|
|
|
|
interface DivProps {
|
|
sx?: SxProps;
|
|
}
|
|
|
|
const theme = createTheme();
|
|
|
|
const Div = styled('div')<DivProps>(
|
|
unstable_styleFunctionSx as StyleFunction<DivProps>,
|
|
);
|
|
|
|
export default function StyleFunctionSxDemo() {
|
|
return (
|
|
<ThemeProvider theme={theme}>
|
|
<Div sx={{ m: 1, p: 1, border: 1 }}>Custom component with the sx prop</Div>
|
|
</ThemeProvider>
|
|
);
|
|
}
|