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

Add static spacing override classes #2457

Closed
owenatgov opened this issue Dec 3, 2021 · 1 comment · Fixed by #2672
Closed

Add static spacing override classes #2457

owenatgov opened this issue Dec 3, 2021 · 1 comment · Fixed by #2672
Labels
design feature request User requests a new feature spacing
Milestone

Comments

@owenatgov
Copy link
Contributor

owenatgov commented Dec 3, 2021

Proposal

Add spacing override classes (eg: govuk-!-margin-bottom-6) that use the static spacing scale rather than the responsive spacing scale.

The desired outcome would be a way to use the classes in such a way that they don't default to the smaller spacing size when moving to mobile. How this might look:

<div class="govuk-!-margin-bottom-6--non-responsive">
...
</div>

The above element would have a bottom margin of 30px across both desktop and mobile instead of moving down to 20px on mobile.

Context

On govuk, we've recently been doing some work to set a new design tone that provides a better experience on smaller devices. We'll be able to see this soon in the launch of the new homepage design. Something we've run into however is that there are instances where we want to maintain spacing across screen sizes in order to both create a consistent experience for users and to adhere to good designs across screen sizes.

We are struggling to meet our needs in a positive way presently. For example, we try to use our govuk heading component in as many places as possible. The bottom margin for this component is handled by a helper in our govuk components repo to create consistent spacing across our components. This spacing helper uses the margin override classes, as seen above, to minimise CSS weight sent to our users, however that means that we're stuck with the responsive spacing by default when it's not always what we want. The best way we've been able to work out to manage this presently is to create custom classes that use the non-responsive govuk-spacing mixin, something we want to avoid doing as we'd be serving extra CSS to our users.

This solution would give us more flexibility in our designs, allowing us to build on top of the design system to create designs that are suitable to the level of information density on govuk whilst still consuming the design system in a positive way.

@36degrees
Copy link
Contributor

Moved to blocked – we still need to write the changelog entry, which we want to do either at the same time or after we write the guidance (alphagov/govuk-design-system#2244).

@36degrees 36degrees changed the title Allow spacing helpers to bypass responsive spacing Add static spacing override classes Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design feature request User requests a new feature spacing
Projects
Development

Successfully merging a pull request may close this issue.

3 participants