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

feat(FormGroup): add hasMargin, add story back in #7936

Merged
merged 4 commits into from
Mar 31, 2021

Conversation

tw15egan
Copy link
Member

@tw15egan tw15egan commented Mar 1, 2021

Refs #5367

After talking with @janhassel, FormGroup is still used but the default margin is problematic. This adds in a new prop hasMargin, which is true by default, that can be toggled off to remove the default bottom margin.

This also adds back in the FormGroup story, which showcases the new prop.

I also realized disabled can be set on the fieldset element itself, which disabled all form elements nested inside. This is a useful feature that should be showcased, so I've also added this to the playground.

Changelog

New

  • FormGroup story added back in
  • hasMargin prop to toggle margin-bottom on the fieldset element rendered by FormGroup
  • Styles to disabled label, helper text nested inside FormGroup

Testing / Reviewing

Check out FormGroup story and ensure it looks good 👍🏻

@netlify
Copy link

netlify bot commented Mar 1, 2021

Deploy preview for carbon-elements ready!

Built with commit a476f59

https://deploy-preview-7936--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Mar 1, 2021

Deploy preview for carbon-components-react ready!

Built without sensitive environment variables with commit a476f59

https://deploy-preview-7936--carbon-components-react.netlify.app

@tw15egan tw15egan requested a review from a team as a code owner March 1, 2021 22:36
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have any clarity on form spacing (and/or component spacing in general) from design? I think the hasMargin addition to the FormGroup API is kind of a band aid solution to a larger problem highlighted in #5367

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have any clarity on form spacing (and/or component spacing in general) from design? I think the hasMargin addition to the FormGroup API is kind of a band aid solution to a larger problem highlighted in #5367

@tw15egan
Copy link
Member Author

tw15egan commented Mar 2, 2021

Yeah, I agree it's definitely a band-aid and this needs to be addressed in our next major, but any changes to the current spacing would be considered a breaking change.

Toggling our default spacing via a prop could also be helpful in our next major on a case-by-case basis in the context of a form. Do you have any other recommendations?

@emyarod
Copy link
Member

emyarod commented Mar 2, 2021

I don't think there's any immediate action to take until we know what the plan for FormGroup/component spacing in general is. for FormGroup specifically, if I understand correctly, consumers would be setting a hasMargin prop rather than adding a style rule, is that right?

@tw15egan
Copy link
Member Author

tw15egan commented Mar 2, 2021

Yes, instead of having to set style rules on a class-by-class basis (or have a global class they could add) this would just remove the margin via a prop.

This also adds the functionality of disabling an entire fieldset by passing down disabled to FormGroup instead of each individual component.

If the main issue is adding in the margin toggle, we can remove that, but in chatting with @janhassel it seems like it would be helpful as teams are currently using FormGroup

@emyarod
Copy link
Member

emyarod commented Mar 2, 2021

my only concern is with the API change, especially if it can become obsolete as early as v11 launch pending a larger design decision (and in this case specifically workarounds are already possible via CSS as you mentioned). for this specific component, if we're not able to get design input about FormGroup, I would lean more towards just adding the fieldset--no-margin class over expanding the component API for the time being, curious to hear others' thoughts on this. aside from that the other changes are good to go

that being said, I'm not sure how soon we'd be reaching a decision about form spacing so maybe adding hasMargin to the form group API is a worthwhile quality of life enhancement, related #2549

@kodiakhq kodiakhq bot merged commit af010e5 into carbon-design-system:main Mar 31, 2021
@tw15egan tw15egan deleted the FormGroup-story branch March 3, 2022 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants