Skip to content

Commit abc01df

Browse files
committed
LabelGroup no longer accepts styled system props (#1565)
1 parent 80dc1c1 commit abc01df

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

.changeset/eleven-cycles-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/components': major
3+
---
4+
5+
LabelGroup no longer accepts styled-system props. Please use the `sx` prop to extend Primer component styling instead. See also https://primer.style/react/overriding-styles for information about `sx` and https://primer.style/react/system-props for context on the removal.

docs/content/LabelGroup.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,13 @@ The LabelGroup component is used to add commonly used margins and wrapping for g
99
```jsx live
1010
<LabelGroup>
1111
<Label>Default label</Label>
12-
<Label sx={{color: "fg.onEmphasis", bg: "danger.emphasis"}}>
13-
Label with background indicating a closed PR state
14-
</Label>
12+
<Label sx={{color: 'fg.onEmphasis', bg: 'danger.emphasis'}}>Label with background indicating a closed PR state</Label>
1513
<Label outline>Default outline label</Label>
1614
</LabelGroup>
1715
```
1816

19-
## System props
20-
21-
<Note variant="warning">
22-
23-
System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
24-
25-
</Note>
26-
27-
LabelGroup components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
28-
2917
## Component props
3018

31-
LabelGroup does not get any additional props.
19+
| Name | Type | Default | Description |
20+
| :--- | :---------------- | :-----: | :----------------------------------- |
21+
| sx | SystemStyleObject | {} | Style to be applied to the component |

src/LabelGroup.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import styled from 'styled-components'
2-
import {COMMON, get, SystemCommonProps} from './constants'
2+
import {get} from './constants'
33
import sx, {SxProp} from './sx'
44
import {ComponentProps} from './utils/types'
55

6-
const LabelGroup = styled.span<SystemCommonProps & SxProp>`
7-
${COMMON}
6+
const LabelGroup = styled.span<SxProp>`
87
& * {
98
margin-right: ${get('space.1')};
109
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
import LabelGroup from '../LabelGroup'
3+
4+
export function shouldAcceptCallWithNoProps() {
5+
return <LabelGroup />
6+
}
7+
8+
export function shouldNotAcceptSystemProps() {
9+
// @ts-expect-error system props should not be accepted
10+
return <LabelGroup backgroundColor="khaki" />
11+
}

0 commit comments

Comments
 (0)