| 1 |
# @patternfly/react-styles |
| 2 |
|
| 3 |
Library that provides CSS-in-JS capabilities |
| 4 |
|
| 5 |
#### Example |
| 6 |
|
| 7 |
```tsx |
| 8 |
import { css } from '@patternfly/react-styles'; |
| 9 |
import styles from './Button.css'; |
| 10 |
|
| 11 |
const Button = ({ isActive, isDisabled, children }) => ( |
| 12 |
<button |
| 13 |
disabled={isDisabled} |
| 14 |
className={css(styles.button, isActive && styles.modifiers.active, isDisabled && styles.modifiers.disabled)} |
| 15 |
> |
| 16 |
{children} |
| 17 |
</button> |
| 18 |
); |
| 19 |
``` |
| 20 |
|
| 21 |
##### DOM output |
| 22 |
|
| 23 |
```html |
| 24 |
<button disabled="" class="pf-c-button pf-is-disabled"> |
| 25 |
Hello World |
| 26 |
</button> |
| 27 |
``` |
| 28 |
|
| 29 |
[classnames]: https://github.com/JedWatson/classnames |
| 30 |
[css-modules]: https://github.com/css-modules/css-modules |
| 31 |
[babel]: https://github.com/babel/babel |
| 32 |
[jest-styled-components]: https://github.com/styled-components/jest-styled-components#snapshot-testing |
| 33 |
[jest-glamor-react]: https://github.com/kentcdodds/jest-glamor-react |
| 34 |
[jest-aphrodite-react]: https://github.com/dmiller9911/jest-aphrodite-react |