Skip to content

Commit

Permalink
Update using-styled-components.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Sep 19, 2024
1 parent 6a29c54 commit db7193f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions develop-docs/frontend/using-styled-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ The best styles are the ones you don’t write - whenever possible use existing

## Basics

To use Style Components pull in `styled` and apply your CSS. For consistent spacing you should also use `space()`:
To use Style Components, import `styled` from `@emotion/styled` and apply custom CSS. For consistent spacing you should also use `space()`:

```tsx
import styled from '@emotion/styled';
import {space} from 'sentry/styles/space';

export default ExampleComponent() {
return (
<SideBySide>
<p>a number: <Numeric>1</Numeric></p>
<p>and another: <Numeric>2</Numeric></p>
</SideBySide>
)
}

const Numeric = styled('span')`
font-variant-numeric: tabular-nums;
`;
Expand All @@ -26,14 +35,6 @@ const SideBySide = styled('div')`
align-items: flex-start;
`;

export default ExampleComponent() {
return (
<SideBySide>
<p>a number: <Numeric>1</Numeric></p>
<p>and another: <Numeric>2</Numeric></p>
</SideBySide>
)
}
```

## Theme
Expand Down

0 comments on commit db7193f

Please sign in to comment.