diff --git a/.changeset/eleven-cycles-search.md b/.changeset/eleven-cycles-search.md new file mode 100644 index 00000000000..053fce53441 --- /dev/null +++ b/.changeset/eleven-cycles-search.md @@ -0,0 +1,5 @@ +--- +'@primer/components': major +--- + +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. diff --git a/docs/content/LabelGroup.md b/docs/content/LabelGroup.md index a4a3bfdec6e..3bf34e4c620 100644 --- a/docs/content/LabelGroup.md +++ b/docs/content/LabelGroup.md @@ -9,23 +9,13 @@ The LabelGroup component is used to add commonly used margins and wrapping for g ```jsx live - + ``` -## System props - - - -System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. - - - -LabelGroup components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ## Component props -LabelGroup does not get any additional props. +| Name | Type | Default | Description | +| :--- | :---------------- | :-----: | :----------------------------------- | +| sx | SystemStyleObject | {} | Style to be applied to the component | diff --git a/src/LabelGroup.tsx b/src/LabelGroup.tsx index edaec3667cf..94e43d9b381 100644 --- a/src/LabelGroup.tsx +++ b/src/LabelGroup.tsx @@ -1,10 +1,9 @@ import styled from 'styled-components' -import {COMMON, get, SystemCommonProps} from './constants' +import {get} from './constants' import sx, {SxProp} from './sx' import {ComponentProps} from './utils/types' -const LabelGroup = styled.span` - ${COMMON} +const LabelGroup = styled.span` & * { margin-right: ${get('space.1')}; } diff --git a/src/__tests__/LabelGroup.types.test.tsx b/src/__tests__/LabelGroup.types.test.tsx new file mode 100644 index 00000000000..2087a28af20 --- /dev/null +++ b/src/__tests__/LabelGroup.types.test.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import LabelGroup from '../LabelGroup' + +export function shouldAcceptCallWithNoProps() { + return +} + +export function shouldNotAcceptSystemProps() { + // @ts-expect-error system props should not be accepted + return +}