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

Support objects for FormGroup legendText prop #6686

Closed
queeniema opened this issue Aug 18, 2020 · 0 comments · Fixed by #6691
Closed

Support objects for FormGroup legendText prop #6686

queeniema opened this issue Aug 18, 2020 · 0 comments · Fixed by #6691

Comments

@queeniema
Copy link

Summary

I am attempting to create a group of radio buttons using the example code in the storybook here.

<FormGroup legendText="My radio button group label">
  <RadioButtonGroup
    name="radio-button-group"
    onChange={onRadioButtonChange}
    orientation="vertical"
    valueSelected="radio-button-1"
  >
    <RadioButton
      id="radio-button-1"
      labelText="First radio button"
      value="radio-button-1"
    />
    <RadioButton
      id="radio-button-2"
      labelText="Second radio button"
      value="radio-button-2"
    />
    <RadioButton
      id="radio-button-3"
      labelText="Third radio button"
      value="radio-button-3"
    />
  </RadioButtonGroup>
</FormGroup>

Screen Shot 2020-08-18 at 9 32 31 AM

I would like to use a Tooltip that contains help information for the legendText prop for the FormGroup component, like the following:

<FormGroup legendText={(
  <Tooltip
    triggerText="My radio button group label"
    direction="right"
  >
    Some help information here...
  </Tooltip>
)}>
// ... RadioButtonGroup here ...
</FormGroup>

Screen Shot 2020-08-18 at 9 40 58 AM

However, it seems that only string values are supported. I see this error:

Warning: Failed prop type: Invalid prop `legendText` of type `object` supplied to `FormGroup`, expected `string`.

Justification

We should be able to display help information if a user needs it.

Also, this is supported for the labelText prop for the TextInput component, so I think it makes sense to have it supported for radio button groups as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants