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

[Feature Request] Add label to Radio Group #412

Closed
SalahAdDin opened this issue Apr 16, 2022 · 0 comments · Fixed by #491
Closed

[Feature Request] Add label to Radio Group #412

SalahAdDin opened this issue Apr 16, 2022 · 0 comments · Fixed by #491
Labels
🔦 Type: Feature New feature or request

Comments

@SalahAdDin
Copy link

SalahAdDin commented Apr 16, 2022

Is your feature request related to a problem? Please describe.

Right now CheckboxGroup have label and Input has helper text and status, but RadioGroup does not have.

All of those properties are ultra required when we have to validate the value of this RadioGroup.

Why are they missing?

Describe the solution you'd like

This input would include label and helperText, status(optional) and helperTextColor.

Describe alternatives you've considered

Passing a Text for both helper text and label.

You can check my solution here: https://codesandbox.io/s/thirsty-gwen-tlfiix

<Col>
  <Text
    color={error ? 'error' : 'default'}
    as="label"
    css={{ fontSize: 14 }}
  >
    {label}
  </Text>
  <Radio.Group
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...fieldProps}
    textColor={error ? 'error' : 'default'}
    color={error ? 'error' : 'default'}
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...field}
  >
    {options.map((option) => (
      <Radio
        key={name + option.value}
        size="xs"
        value={option.value}
        css={{ mt: 10 }}
      >
        {option.label}
      </Radio>
    ))}
  </Radio.Group>
  {error && (
    <Text
      as="p"
      color={error ? 'error' : 'default'}
      css={{
        ml: 10,
        fontSize: 12,
      }}
      role="alert"
    >
      {error.message}
    </Text>
  )}
</Col>

Screenshots or Videos

image
Color is required but it does not show any message to help the user to understand why the form is not being submitted.

@SalahAdDin SalahAdDin added the 🔦 Type: Feature New feature or request label Apr 16, 2022
@jrgarciadev jrgarciadev linked a pull request Jun 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔦 Type: Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants