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

FormGroup component #116

Closed
LeBenLeBen opened this issue Jan 26, 2022 · 0 comments
Closed

FormGroup component #116

LeBenLeBen opened this issue Jan 26, 2022 · 0 comments
Assignees
Labels
feature New feature to be implemented

Comments

@LeBenLeBen
Copy link
Collaborator

LeBenLeBen commented Jan 26, 2022

When creating forms, fields usually need some defaults to be accessible:

  • A single field must be labelled, usually by a label element (using a for/id pair, except on custom elements like CSelect where aria-labelledby should be used)
  • It can happen that fields have additional information than just a label, like the desired format, which also needs to be linked to the field (using aria-describedby)
  • If a field got errors, those needs to be announced (using aria-describedby)
  • We often want to change the label/field style when it’s invalid
  • When a field is required, we want the required attribute on the field itself, but we also want a visual indicator to highlight them, like a * next to the label

For these reasons, it would be great to have a FormGroup component that holds the state for a field:

  • Generate IDs to automatically link label/infos/errors with the field
  • Accept and provide to its children props that can impact multiple children, like required and errors.
@LeBenLeBen LeBenLeBen added the feature New feature to be implemented label Jan 26, 2022
@LeBenLeBen LeBenLeBen self-assigned this Feb 6, 2022
@LeBenLeBen LeBenLeBen mentioned this issue Feb 18, 2022
5 tasks
@LeBenLeBen LeBenLeBen changed the title FormGroup/Label/ErrorMessages components FormGroup component Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature to be implemented
Projects
None yet
Development

No branches or pull requests

1 participant