Files
react-test/docs/data/system/getting-started/custom-components/StyleFunctionSxDemo.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
561 B
TypeScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
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>
);
}