Currently button text doesn’t wrap on smaller screens which causes buttons to be cut off.
Suggest a simple fix. Change .nsw-button white-space:nowrap; to white-space:normal;
Currently buttons have a 1rem margin-right to allow multiple buttons to sit alongside each other. This causes larger right spacing for single buttons on smaller screens. Are we able to remove this margin if there’s only a single button? Perhaps we could use the :last-of-typeselector to remove the margin-right?
Looks like we need to make sure the button doesn’t extend beyond the parent element. I’ll check in with Anna about best practice - last-of-type sounds like a good idea - we’ll test what happens when the buttons themselves need to wrap.
Thanks @benjamin. Also noticed that when buttons are side-by-side in desktop / stacked in mobile, they are different widths. Have you considered forcing the full width for CTA buttons in mobile?
Hi @jennifer.weiley what we could do is add a full-width variant to the button component instead of forcing it to be full-width globally because this might not fit all use cases.
Good thinking @benjamin. I was wondering however how this might work from desktop to mobile and found an example on the NZ site, where the desktop size of the button is based on the text and the mobile fits to width. This might work, together with allowing text to wrap where necessary.
Hi @benjamin - our Dev team has also been asked to deliver this. Have you made any progress? If you haven’t, we’d be happy to share with you if we have something to show from the upcoming sprint. cc @tjharrop
Hi @jennifer.weiley we have added this in our sprint and @anna.yeshtukova will be working on it. Looking into getting in live next week for our next release.
If ever there is something else your team would like to share, they may fork our repo and create a pull request for it. Appreciate the help.
That’s excellent news @benjamin and we’re definitely keen to collaborate and share. Let us know when it’s done and we’ll grab it for nsw.gov.au. And do get in touch to check out anything new we’ve delivered or working on that you might be interested in.