ui-components icon indicating copy to clipboard operation
ui-components copied to clipboard

Checkbox: Checkbox item spacing

Open Spark450 opened this issue 1 year ago • 2 comments

Info

The added margin bottom to the checkbox items (which does not exist on other inputs) is causing the error and helper text to be pushed down away from the input.

Issue was reported by Binoy Kanchanwala on August 14th 2024

Design specifications

Reference the following Figma designs

To Reproduce

Issue is viewable on the design system website sandbox

return (
  <GoAFormItem
    label="Basic"
    labelSize="regular"
    helpText=<>Some helper</>
    error=<>Some error</>
  >
    <GoACheckbox
      name="item"
      text="Item"
      value=""
      onChange={onChange}
      checked={true}
    ></GoACheckbox>
  </GoAFormItem>
);

Additional context

Some screenshots provided by the reporting team: image image

Acceptance Criteria

  1. Reduce line-height on Checkbox

Spark450 avatar Aug 14 '24 18:08 Spark450

The extra space is coming from two sources:

  1. A default bottom margin
  2. Line height

First, the checkbox has a bottom margin. image

You can remove it by adding mb="none" to the checkbox.

<goa-checkbox name="item" text="Item" mb="none" />

But the checkbox still has an extra 5px of vertical space compared to the Figma component. This is coming from an inherited line height of line-height-3.

image

When I add the below CSS to the checkbox component, the component height is the same as in Figma: 28px.

:host { line-height: 100%; }

image

bdfranck avatar Aug 15 '24 15:08 bdfranck

Do teams use the checkbox more often without a bottom margin? 🤔 If so, we could change the default bottom margin on the checkbox to none.

bdfranck avatar Aug 15 '24 15:08 bdfranck

Consider fixing this by working on #2267

Spark450 avatar Dec 17 '24 17:12 Spark450

As Benji mentioned, currently this can be worked around with margin: none on the last checkbox in a group. Additional spacing adjusted in this PR: https://github.com/GovAlta/ui-components/pull/2296

It would be nice to have it automatically in it's own component as in https://github.com/GovAlta/ui-components/issues/2267, which is also a need for the public form to work properly.

twjeffery avatar Dec 18 '24 18:12 twjeffery

This issue gets resolved by: https://github.com/GovAlta/ui-components/pull/2296

Could not link this issue to that PR because it's exceeded max of 10 linked issues.

BumbleB2na avatar Dec 20 '24 17:12 BumbleB2na

Closing as this has been done

dustin-nielsen-goa avatar Apr 07 '25 23:04 dustin-nielsen-goa