Skip to content

px / mx style-prop shorthands are physical (left/right), not logical (inline) #16

@0xNeit

Description

@0xNeit

Summary

The px and mx style-prop shorthands expand to physical paddingLeft+paddingRight / marginLeft+marginRight, not the logical paddingInline / marginInline. They do not adapt to writing direction.

Details

  • packages/core/src/style-props.ts:95px: { cssProperty: ['paddingLeft', 'paddingRight'], scale: 'space' }
  • packages/core/src/style-props.ts:105mx: { cssProperty: ['marginLeft', 'marginRight'], scale: 'space' }
  • paddingInline / marginInline are available as their own long-form style props, so logical insets are possible — just not through the x shorthands.

Impact

A sharp edge: px / mx look like the natural choice for horizontal insets, and are the idiom in peer libraries, yet they silently break RTL mirroring. Related to #11 (RTL not implemented).

Suggested fix

  • Preferred: map px / mx to the logical paddingInline / marginInline — consistent with the cross-platform and RTL goals. (On native, pair this with the RTL resolution work from RTL / bidirectional layout not implemented despite being a committed v1 feature #11.)
  • Otherwise: keep them physical but document the distinction in apps/docs/content/reference/style-props.mdx and steer RTL-sensitive code toward paddingInline / marginInline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions