question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Design system: Forms

See original GitHub issue

Figma file

Let’s create common components for all forms that aims for consistency and accessibility. There are already some components in /src/components/common/forms.

  • Create a single component for field groups (accepts a label, isRequired, and field component prop). Required fields get a readable ‘required’ label

This should then render something like:

<div class...>
<label for={id}>{label} <span>Required</span></label>
{children}
</div>
  • Create components for common input elements that use that field group. Something like:
const FormInput = ({type, name, label, isRequired, onChange}) => (
  <FormGroup label={label} isRequired={isRequired} id={name}>
  <input type={text} name={name} id={id} onChange={onChange}/>
</FormGroup>
)

Create one of these for:

  • Regular input field, with configurable type prop, i.e. <FormInput type="text"> would render an <input type="text"> in a field group.

  • Textarea

  • Radio & checkbox (maybe we just pass an array of values?)

  • We also need to pass events to these as well, let’s do onChange for now. There is only one form that monitors inputs.

  • Support for half-width form groups

Update forms:

  • Volunteer form
  • Contact form
  • Get involved form
  • Search page

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
keveecommented, Jun 9, 2020

@tiagofsanchez cool! I’m assigning this issue to you and creating a branch preview for your branch.

0reactions
tiagofsanchezcommented, Jun 13, 2020

@kevee, made same progress and should be finishing tonight… did you set up a branch preview? where can I see that? Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form – Carbon Design System
A form is a group of related input controls that allows users to provide data or configure options. Overview; Live demo; Formatting; Form...
Read more >
Forms - Patterns - Atlassian Design System
Forms are used to get information and guide people with minimal fuss. Designing forms well requires making decisions about structure, sequence, ...
Read more >
Form - Goldman Sachs Design System
Form is a set of components that help to systematically layout and build forms. View GSUI Toolkit Documentation (Internal Only) · View in...
Read more >
Form | U.S. Web Design System (USWDS) - Digital.gov
Customize accessibly. As you customize these templates, make sure they meet the accessibility guidelines in this introduction and as described for each control....
Read more >
Forms - the W3C design system
¶Top tips · Every <input> needs a <label> . · Do not use the placeholder attribute on <input> fields. · Use fixed width...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found