Skip to content

Commit 055b127

Browse files
committed
Tooltip no longer accepts styled system props (#1577)
1 parent f99bf16 commit 055b127

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

.changeset/silver-worms-talk.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+
Tooltip 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/Tooltip.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,13 @@ Before adding a tooltip, please consider: Is this information essential and nece
2020
</Box>
2121
```
2222

23-
## System props
24-
25-
<Note variant="warning">
26-
27-
System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
28-
29-
</Note>
30-
31-
Tooltip components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
32-
3323
## Component props
3424

35-
| Name | Type | Default | Description |
36-
| :--------- | :------ | :-----: | :------------------------------------------------------- | --------------------------------------------------------- |
37-
| align | String | | Can be either `left` or `right`. |
38-
| direction | String | | Can be one of `n`, `ne`, `e`, `se`, `s`, `sw`, `w`, `nw` | Sets where the tooltip renders in relation to the target. |
39-
| noDelay | Boolean | | When set to `true`, tooltip appears without any delay |
40-
| aria-label | String | | Text used in `aria-label` (for accessibility). |
41-
| wrap | Boolean | | Use `true` to allow text within tooltip to wrap. |
25+
| Name | Type | Default | Description |
26+
| :--------- | :---------------- | :-----: | :------------------------------------------------------------------------------------------------------------------ |
27+
| align | String | | Can be either `left` or `right`. |
28+
| direction | String | | Can be one of `n`, `ne`, `e`, `se`, `s`, `sw`, `w`, `nw`. Sets where the tooltip renders in relation to the target. |
29+
| noDelay | Boolean | | When set to `true`, tooltip appears without any delay |
30+
| aria-label | String | | Text used in `aria-label` (for accessibility). |
31+
| wrap | Boolean | | Use `true` to allow text within tooltip to wrap. |
32+
| sx | SystemStyleObject | {} | Style to be applied to the component |

src/Tooltip.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import classnames from 'classnames'
22
import React from 'react'
33
import styled from 'styled-components'
4-
import {COMMON, get, SystemCommonProps} from './constants'
4+
import {get} from './constants'
55
import sx, {SxProp} from './sx'
66
import {ComponentProps} from './utils/types'
77

8-
const TooltipBase = styled.span<SystemCommonProps & SxProp>`
8+
const TooltipBase = styled.span<SxProp>`
99
position: relative;
1010
1111
&::before {
@@ -229,7 +229,7 @@ const TooltipBase = styled.span<SystemCommonProps & SxProp>`
229229
&.tooltipped-align-left-2::before {
230230
left: 10px;
231231
}
232-
${COMMON};
232+
233233
${sx};
234234
`
235235

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 Tooltip from '../Tooltip'
3+
4+
export function shouldAcceptCallWithNoProps() {
5+
return <Tooltip />
6+
}
7+
8+
export function shouldNotAcceptSystemProps() {
9+
// @ts-expect-error system props should not be accepted
10+
return <Tooltip backgroundColor="thistle" />
11+
}

0 commit comments

Comments
 (0)