Skip to content

Fix alignment / padding of ha-switch#7349

Merged
bramkragten merged 2 commits intohome-assistant:devfrom
spacegaier:ha-switch-padding
Oct 19, 2020
Merged

Fix alignment / padding of ha-switch#7349
bramkragten merged 2 commits intohome-assistant:devfrom
spacegaier:ha-switch-padding

Conversation

@spacegaier
Copy link
Member

Breaking change

Proposed change

Previously the <ha-switch> was not properly aligned, see the before/after screenshots. I added 8px of padding, since the material guide says increments of 4px (source), although here 6px might suffice.

image

image

image

image

There is one visual difference I can spot: The label next to the switch is now a bit farther away. That is because the following selector adds a 4px padding on its own. In other frontend areas where a <ha-switch>is used this does not come into play, since there (e.g. enable buttons of automation or the entity enable button) they are not used in combination with a <ha-formfield>.

.mdc-form-field > label {
    margin-left: 0;
    margin-right: auto;
    padding-left: 4px;
    padding-right: 0;
    order: 0;
}

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten
Copy link
Member

So officially we should not add padding, but I also don't see our use-case in the material specs. We should make sure the switch lines with the rest of the content, don't stick to the 4px rules of material here.

@spacegaier
Copy link
Member Author

I adjusted the pixels, so it now fits nicely.
image

@bramkragten bramkragten merged commit 19fc375 into home-assistant:dev Oct 19, 2020
@spacegaier spacegaier deleted the ha-switch-padding branch October 19, 2020 12:51
@bramkragten bramkragten mentioned this pull request Oct 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants