Skip to content
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

REQ: Utility classes scoped to breakpoints #1153

Open
paulmsmith opened this issue Feb 21, 2025 · 5 comments
Open

REQ: Utility classes scoped to breakpoints #1153

paulmsmith opened this issue Feb 21, 2025 · 5 comments
Labels
Enhancement: feature request New feature or request

Comments

@paulmsmith
Copy link

paulmsmith commented Feb 21, 2025

Utility classes are very useful, they save us needing to write new scss/css selectors to tweak spacing but by default they apply across all 'breakpoints'.

Often as components go from being stacked on small viewports to being laid out in columns for larger viewports, it would be helpful to be able to declaratively adjust that spacing.

For example: .nhsuk-u-margin-bottom-0--from-desktop or .nhsuk-u-margin-bottom-0--until-desktop

@paulmsmith paulmsmith added the Enhancement: feature request New feature or request label Feb 21, 2025
@paulmsmith
Copy link
Author

As they'd generate a bunch of css perhaps they could be optionally configured in settings? So they are only outputted to css when needed.

@edwardhorsford
Copy link
Contributor

I've certainly come across this need before - though have typically made a custom class then and used the media query mixins to do what I needed.

A risk with these might be that they don't get used?

@paulmsmith
Copy link
Author

paulmsmith commented Feb 21, 2025

A risk with these might be that they don't get used?

Yeh, I thought about that. Maybe a Sass setting variable $nhsuk-responsive-utilites or something would prevent them being outputted to the compiled css by default.

@colinrotherham
Copy link
Contributor

colinrotherham commented Feb 21, 2025

GOV.UK Frontend includes *-from-desktop classes:
https://design-system.service.gov.uk/styles/layout/#desktop-specific-grid-classes

I could update our grid styles to pick them up as a freebie?

They've deprecated govuk-grid-row() though and we use it in one place:

https://github.com/search?q=org%3Anhsuk+govuk-grid-row%28&type=code
https://github.com/search?q=org%3ANHSDigital%20govuk-grid-row%28&type=code

Not necessarily a problem

@colinrotherham
Copy link
Contributor

colinrotherham commented Feb 21, 2025

Ahh so the NHS grid layout uses $at: tablet $at: desktop unlike GOV.UK Frontend

So from mobile and up, the class .nhsuk-grid-column-one-quarter kicks in later at desktop (not tablet)

But I've given it a go in #1154 and it's all working 🙌

.nhsuk-grid-column-one-quarter-from-tablet
.nhsuk-grid-column-one-third-from-tablet
.nhsuk-grid-column-one-half-from-tablet
.nhsuk-grid-column-two-thirds-from-tablet
.nhsuk-grid-column-three-quarters-from-tablet
.nhsuk-grid-column-full-from-tablet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants