-
Notifications
You must be signed in to change notification settings - Fork 6
feat(button): add isSpread prop #1844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Biggest concerns:
I restarted the Chromatic action to take a look at the preview build |
| &.nds-button--xs .nds-button-content, | ||
| &.nds-button--s .nds-button-content, | ||
| &.nds-button--m .nds-button-content { | ||
| width: 100% !important; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two changes requested:
Ensure the button fills parent width when isStretch
We want the entire button to have width: 100% so it fills its parent container.
It might also be nice to left align
Special handling for SplitButton
The SplitButton component takes all the same props as Button, including the new isSpread. A spread split button should look like this:
You can intercept the isSpread props to apply a 100% width to the root element of SplitButton when the prop is truthy
tl;dr
We want the layout for Button to be like this when spread (start and end content & icons in red):

For SplitButton:
Fill 100% width and let the Button size stretch



There's a design need to have a button with an end icon, where the two are split across the length of the button (think space-between). This PR attempts to implement that in the current Button component.
I don't love the implementation, and it's a bit messy, but it does the trick. Open to thoughts/comments.
Desired from Figma:

Actual storybook with this change
