iTwin / iTwinUI

A design system for building beautiful and well-working web interfaces.
https://itwin.github.io/iTwinUI/
MIT License
92 stars 35 forks source link

add `stretch` prop to `Button` #1971

Closed mayank99 closed 4 weeks ago

mayank99 commented 1 month ago

Changes

The new stretch prop essentially applies inline-size: 100%. This is most useful in narrow layouts (e.g. appui widgets) and mobile views.

image

See similar examples from other design systems: 1, 2, 3


Implementation notes: This is implemented using a private inline CSS variable. There is some global CSS applied on every element, where this CSS variable's value is used to convert it to inline-size. Benefits:

Testing

Added story + visual test + unit test.

Docs

Added jsdocs + documentation section + changeset.