Skip to content

Remove sx props from Paragraph component #1476

@aaronadamsCA

Description

@aaronadamsCA

sx={{
// reset margin by default: avoid relying on user-agent margins (not aware of theme-ui space scale)
margin: 0,
// set a max-width: avoid full-page paragraphs
'@media screen and (min-width: 36em)': {
maxWidth: '48rem',
},
...sx,
}}

While I appreciate the intent, this makes it really tough to use Paragraph except for one very specific use case. It takes a specificity hack to defeat it using the theme:

export const theme = {
  text: {
    paragraph: {
      ':not(_)': {
        my: 3,
        maxWidth: 'unset'
      }
    }
  }
}

I think the margin reset probably belongs in a base theme, and the maxWidth is an interesting idea that could be mentioned in the documentation or included in a paragraph variant in one of the themes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions