diff --git a/packages/docs/src/pages/sx-prop.mdx b/packages/docs/src/pages/sx-prop.mdx index 7e5250cbc..f7504f3d6 100644 --- a/packages/docs/src/pages/sx-prop.mdx +++ b/packages/docs/src/pages/sx-prop.mdx @@ -407,6 +407,45 @@ import { Box } from 'theme-ui' ``` +## Work with `className` + +`theme-ui` has its own function to build JSX with sx prop. How does it works? +`theme-ui` will use `praseProps` to deal with all props. it will firstly deal +with `sx` and/or `css` props, to get the **new** `css` prop with original props +except the **old** `sx` and/or **old** `css` props. Then it will let +`emtion`'s `jsx` function to finish the other works. + +You can click [emotion css-prop][] to get more infomation. + +[emotion]: https://emotion.sh/docs/css-prop#style-precedence + +So, emtion will deal with the **new** `css` prop and `className`(for example, +`'bar'`) prop. Then make **new** style class with new name(for example, +`'foo'`), and replace old `className` with new `className`. + +``` jsx +const Comp = (props) => { + // - theme-ui will turn `sx` prop into `css` prop. + // - emtion will mixin `css` prop and `className` prop to get new `className` + // prop +
+} + +