diff --git a/.changeset/purple-buttons-look.md b/.changeset/purple-buttons-look.md
new file mode 100644
index 00000000000..10856c1cdfc
--- /dev/null
+++ b/.changeset/purple-buttons-look.md
@@ -0,0 +1,5 @@
+---
+'@primer/components': major
+---
+
+Buttons no longer accept 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.
diff --git a/docs/content/Buttons.md b/docs/content/Buttons.md
index 54e84b11ead..c7eabe8ea38 100644
--- a/docs/content/Buttons.md
+++ b/docs/content/Buttons.md
@@ -17,9 +17,9 @@ To create a button group, wrap `Button` elements in the `ButtonGroup` element. `
Button Outline
Button Primary
Button Invisible
- window.alert('button clicked')}/>
+ window.alert('button clicked')} />
-
+
Button
Button
Button
@@ -29,27 +29,17 @@ To create a button group, wrap `Button` elements in the `ButtonGroup` element. `
>
```
-## System props
-
-
-
-System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
-
-
-
-`Button` and `ButtonGroup` components get `COMMON` and `LAYOUT` system props. Read our [System Props](/system-props) doc page for a full list of available props.
-
## Component props
Native `` HTML attributes are forwarded to the underlying React `button` component and are not listed below.
### Button
-| Prop name | Type | Default | Description |
-| :-------- | :--------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------- |
-| as | String | `button` | sets the HTML tag for the component |
-| fontSize | Number or String | | explicitly sets the font size for the Button text; overrides any value for the `variant` prop |
-| variant | String | 'medium' | a value of `small`, `medium`, or `large` results in smaller or larger Button text size; no effect if `fontSize` prop is set |
+| Prop name | Type | Default | Description |
+| :-------- | :---------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------- |
+| as | String | `button` | sets the HTML tag for the component |
+| sx | SystemStyleObject | {} | Additional styles |
+| variant | String | 'medium' | a value of `small`, `medium`, or `large` results in smaller or larger Button text size; no effect if `fontSize` prop is set |
### ButtonGroup
diff --git a/src/Button/Button.tsx b/src/Button/Button.tsx
index 5ae1fb1a1e6..204cbf25179 100644
--- a/src/Button/Button.tsx
+++ b/src/Button/Button.tsx
@@ -2,9 +2,9 @@ import styled from 'styled-components'
import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ComponentProps} from '../utils/types'
-import ButtonBase, {ButtonBaseProps, ButtonSystemProps, buttonSystemProps} from './ButtonBase'
+import ButtonBase, {ButtonBaseProps} from './ButtonBase'
-const Button = styled(ButtonBase)`
+const Button = styled(ButtonBase)`
color: ${get('colors.btn.text')};
background-color: ${get('colors.btn.bg')};
border: 1px solid ${get('colors.btn.border')};
@@ -32,7 +32,6 @@ const Button = styled(ButtonBase)`
border-color: ${get('colors.btn.border')};
}
- ${buttonSystemProps};
${sx};
`
diff --git a/src/Button/ButtonBase.tsx b/src/Button/ButtonBase.tsx
index cf3ee633084..90dffc80733 100644
--- a/src/Button/ButtonBase.tsx
+++ b/src/Button/ButtonBase.tsx
@@ -1,12 +1,8 @@
import styled from 'styled-components'
-import {compose, fontSize, FontSizeProps, variant} from 'styled-system'
-import {COMMON, LAYOUT, SystemCommonProps, SystemLayoutProps} from '../constants'
+import {variant} from 'styled-system'
import {ComponentProps} from '../utils/types'
import buttonBaseStyles from './ButtonStyles'
-export const buttonSystemProps = compose(fontSize, COMMON, LAYOUT)
-export type ButtonSystemProps = FontSizeProps & SystemCommonProps & SystemLayoutProps
-
const variants = variant({
variants: {
small: {
@@ -26,7 +22,7 @@ const variants = variant({
type StyledButtonBaseProps = {
as?: 'button' | 'a' | 'summary' | 'input' | string | React.ReactType
variant?: 'small' | 'medium' | 'large'
-} & FontSizeProps
+}
const ButtonBase = styled.button.attrs(({disabled, onClick}) => ({
onClick: disabled ? undefined : onClick
diff --git a/src/Button/ButtonClose.tsx b/src/Button/ButtonClose.tsx
index 690ec4927f4..ae8dda017e9 100644
--- a/src/Button/ButtonClose.tsx
+++ b/src/Button/ButtonClose.tsx
@@ -1,13 +1,11 @@
import {XIcon} from '@primer/octicons-react'
import React, {forwardRef} from 'react'
import styled from 'styled-components'
-import {COMMON, get, LAYOUT, SystemCommonProps, SystemLayoutProps} from '../constants'
+import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ComponentProps} from '../utils/types'
-type StyledButtonProps = SystemCommonProps & SystemLayoutProps & SxProp
-
-const StyledButton = styled.button`
+const StyledButton = styled.button`
border: none;
padding: 0;
background: transparent;
@@ -23,8 +21,6 @@ const StyledButton = styled.button`
&:hover {
color: ${get('colors.accent.fg')};
}
- ${COMMON};
- ${LAYOUT};
${sx};
`
diff --git a/src/Button/ButtonDanger.tsx b/src/Button/ButtonDanger.tsx
index d7a7a18b492..8c97b5f41f7 100644
--- a/src/Button/ButtonDanger.tsx
+++ b/src/Button/ButtonDanger.tsx
@@ -2,9 +2,9 @@ import styled from 'styled-components'
import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ComponentProps} from '../utils/types'
-import ButtonBase, {ButtonBaseProps, ButtonSystemProps, buttonSystemProps} from './ButtonBase'
+import ButtonBase, {ButtonBaseProps} from './ButtonBase'
-const ButtonDanger = styled(ButtonBase)`
+const ButtonDanger = styled(ButtonBase)`
color: ${get('colors.btn.danger.text')};
border: 1px solid ${get('colors.btn.border')};
background-color: ${get('colors.btn.bg')};
@@ -35,7 +35,6 @@ const ButtonDanger = styled(ButtonBase)`
+const ButtonInvisible = styled(ButtonBase)`
color: ${get('colors.accent.fg')};
background-color: transparent;
border: 0;
@@ -24,7 +24,6 @@ const ButtonInvisible = styled(ButtonBase)`
+const ButtonOutline = styled(ButtonBase)`
color: ${get('colors.btn.outline.text')};
border: 1px solid ${get('colors.btn.border')};
background-color: ${get('colors.btn.bg')};
@@ -35,7 +35,6 @@ const ButtonOutline = styled(ButtonBase)`
+export const ButtonPrimary = styled(ButtonBase)`
color: ${get('colors.btn.primary.text')};
border: 1px solid ${get('colors.btn.primary.border')};
background-color: ${get('colors.btn.primary.bg')};
@@ -33,7 +33,6 @@ export const ButtonPrimary = styled(ButtonBase)`
+const ButtonTableList = styled.summary`
display: inline-block;
padding: 0;
font-size: ${get('fontSizes.1')};
@@ -48,9 +38,6 @@ const ButtonTableList = styled.summary`
border: 4px solid transparent;
border-top-color: currentcolor;
}
- ${COMMON}
- ${TYPOGRAPHY}
- ${LAYOUT}
${sx};
`
diff --git a/src/__tests__/Button.test.tsx b/src/__tests__/Button.test.tsx
index 231c50d5b27..f4d1c9293ba 100644
--- a/src/__tests__/Button.test.tsx
+++ b/src/__tests__/Button.test.tsx
@@ -48,7 +48,7 @@ describe('Button', () => {
})
it('respects width props', () => {
- expect(render( )).toHaveStyleRule('width', '200px')
+ expect(render( )).toHaveStyleRule('width', '200px')
})
it('respects the "disabled" prop', () => {
@@ -63,7 +63,7 @@ describe('Button', () => {
})
it('respects the "fontSize" prop over the "variant" prop', () => {
- expect(render( )).toHaveStyleRule('font-size', '20px')
+ expect(render( )).toHaveStyleRule('font-size', '20px')
})
})