From 7d8c35fd72a15ba8361dbfed218e716fbfa5a403 Mon Sep 17 00:00:00 2001 From: Mu Jing Date: Tue, 6 Sep 2016 12:36:34 -0700 Subject: [PATCH] Add documentation for including styles that use the value of a prop --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 418bd8b8..fc2f5d86 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,35 @@ export default withStyles(({ color, unit }) => ({ `className` and `style` props must not be used on the same elements as `css()`. +### Using the value of a prop / high cardinality + +To include styles that use the value of a prop (or any other styles that have a high cardinality and shouldn't be in a themed stylesheet), you can use inline styles in conjunction with `withstyles()`. + +```jsx +function MyComponent({ bold, padding, styles }) { + const { + backgroundImageUrl, + } = this.props; + + return ( +
+ Try to be a rainbow in{' '} + + someone's cloud + +
+ ); +} +``` + ## In the wild [Organizations and projects using `react-with-styles`](INTHEWILD.md).