Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/mantine.dev/src/pages/styles/emotion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,34 @@ function Demo() {
}
```

### mergeSx function

You can use the `mergeSx` function to merge multiple `sx` props into one. This
can be useful for merging `sx` prop provided to a custom component with its
own `sx`, like so:

```tsx
import { Box } from '@mantine/core'
import { EmotionSx, mergeSx } from '@mantine/emotion'

interface MyCustomBoxProps {
sx?: EmotionSx
}

function MyCustomBox({ sx }: MyCustomBoxProps) {
return (
<Box sx={mergeSx(theme => ({ ... }), sx)}>...</Box>
)
}

function App() {
return (
<MyCustomBox sx={(theme) => ({ ... })} />
)
}
```


## styles prop

`styles` prop works similar to `sx` prop, but it allows adding styles to all
Expand Down
Loading