Skip to content

Commit

Permalink
feat: Add example for using the library with object notation (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafauke authored Mar 15, 2020
1 parent f24d153 commit 0db488d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ const Component = styled.div`
</ThemeProvider>;
```

### Object notation

When using object notation, make sure to explicitly pass `props` to breakpoint
methods. Please see the example below using default configuration:

```js
import styled from 'styled-components';
import { down, between } from 'styled-breakpoints';

const Component = styled('div')(props => ({
color: 'black',
[down('tablet')(props)]: {
color: 'lightcoral'
},
[between('sm', 'md')(props)]: {
color: 'hotpink'
}
}))
```

## API

<strong>All incoming values are converted to em.</strong>
Expand Down

0 comments on commit 0db488d

Please sign in to comment.