-
Notifications
You must be signed in to change notification settings - Fork 324
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
Allow Border color, width and style to be customized via style prop #3965
Allow Border color, width and style to be customized via style prop #3965
Conversation
🦋 Changeset detectedLatest commit: befe3e8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Hi @judygab! Thank you for submitting this PR! I gave it a test drive and the style props definitely work.

One thing that would be great to add is allowing our theme tokens to be usable as values of the borderColor and borderWidth props like how our other style props work. Essentially, we should be able to do <Divider borderColor="red.10" borderWidth="small" />
where red.10 is a color token and small is a borderWidth token.
You can compare how this is done with backgroundColor with the ColorKeys
type and the mapping to theme tokens here.
…s://github.com/judygab/amplify-ui into react/border-width-color-style-via-style-props
@hbuchel thanks for the feedback! I have just committed changes adding color and space theme tokens to |
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.
Thanks @judygab Looking good! Left one small comment. Additionally, can you please update the test snapshot? That will fix the failing tests. Inside packages/react you can run yarn test -- -u
and then commit the changes to the updated snapshot file.
@hbuchel sure! how can I update snapshot tests? When I run |
Try running that from within /packages/react
That should result in the snapshot file updating (which you can commit those changes) and then tests should also pass. |
that's exactly what I did but it didn't update any files, |
Hmmm that shouuuuuuld have worked. Maybe you need to build the repo first? You can do that with a I also pushed a change to the branch on our repo, you should be able to update your PR with it judygab/amplify-ui@react/border-width-color-style-via-style-props...aws-amplify:amplify-ui:react/border-width-color-style-via-style-props |
could be, will try that, thanks! Also updating my branch. Anything else for this pr? |
Co-authored-by: Heather Buchel <hbuchel@gmail.com>
…s://github.com/judygab/amplify-ui into react/border-width-color-style-via-style-props
@judygab I realized with some further testing of the props that we needed to export BorderWidthKeys from the ui package to use with our borderWidth type. Tested with the Divider examples; the first screenshot shows the type autocompletes showing all of the space keys. The second screenshot shows the correct borderWidth keys after this change. ![]() ![]() I made that change in this commit here I also merged in changes from main; please sync from this branch and update your PR. Thanks! After that I'll ping the team for further reviews. |
@hbuchel oh I see so it was just the type export that we were missing, right? |
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.
Thanks @judygab! Smoke tested the last changes and it looks good to me.


I'll ping the team about getting this included in our next release.
@judygab Two updates I pushed here if you can please merge those into your PR:
|
Hi @judygab just an FYI we merged these changes as part of a separate PR, just to make merging all the changes from main a little easier since there have been some major releases recently. Thank you so much for this feature contribution! |
Description
border
but with also attributes likeborderColor
,borderWidth
,borderStyle
Issue #, if available
Fixes: #3945
Description of how you validated changes
Checklist
yarn test
passes and tests are updated/addedsideEffects
field updatedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.