Skip to content

Unable to align Button content without sx prop css selectors #4115

Closed
primer/eslint-plugin-primer-react
#133
@sdehm

Description

@sdehm

Description

The Button component has an alignContent prop which allows aligning the text of the button for cases such as with block enabled. This is shown in the storybook Button playground like this.

When this prop is used however there is an eslint warning primer-react/no-system-props with more info here that recommends against using "styled-system props" such as alignContent. While it is true that you can use the sx prop to align the content by styling the nested spans, like the example below, this isn't immediately clear.

sx={{
  "& span": {
    justifyContent: "start",
  },
}}

Steps to reproduce

Create a Button component with block and alignContent="start" and observe the eslint warning.

Version

v36.4.0

Browser

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomponent: ButtonIssues related to the Button componentreact

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions