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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HelpText/FieldError for standalone Checkbox, Radio, and Switch #6192

Open
LFDanLu opened this issue Apr 11, 2024 · 3 comments
Open

Comments

@LFDanLu
Copy link
Member

LFDanLu commented Apr 11, 2024

Provide a general summary of the feature here

We will want to support HelpText/FieldError for standalone Checkbox and Radio. Switch should support just HelpText.

馃 Expected Behavior?

The api should look something like this (naming of the wrapper to be finalized):

<CheckboxField>
   <Checkbox>Unsubscribe</Checkbox>
   <Text slot="description">Description here.</Text>
   <FieldError />
</CheckboxField>

Note that the field error context will need to be set in the wrapper

馃槸 Current Behavior

HelpText/FieldError isn't supported for any of these components yet

馃拋 Possible Solution

No response

馃敠 Context

These are all valid use cases for these components, we just didn't add support for them yet

馃捇 Examples

No response

馃Б Your Company/Team

RSP

馃暦 Tracking Issue

No response

@alexasselin008
Copy link
Contributor

alexasselin008 commented Apr 19, 2024

Hi! i'm looking at this issue because i was thinking of implementing something similar in my design system.

The api should look something like this (naming of the wrapper to be finalized):

<CheckboxField>
   <Checkbox>Unsubscribe</Checkbox>
   <Text slot="description">Description here.</Text>
   <FieldError />
</CheckboxField> ```

In Spectrum and RAC Starter kits, fields are usually wrapped and offer props like description, errorMessage and label. So i imagine the component in RAC Starter kit would look like this.

<CheckboxField
    label="Unsubscribe"
    description="Description here." />

Would the intention in the starter kit be to completely replace Checkbox, or would the intention be to use Checkbox and CheckboxField as needed, for instance inside a CheckboxGroup?

<CheckboxGroup label="Choices">
    <Checkbox>Option 1<Checkbox>
    <CheckboxField
        label="Option 2"
        description="Description of option 2 here." />
    <Checkbox>Option 3<Checkbox>
<CheckboxGroup>

@LFDanLu
Copy link
Member Author

LFDanLu commented Apr 19, 2024

Good question, I'd lean towards always having CheckboxField aka completely replace Checkbox in the starter kit. Can't really think of any reasons to have the two separated within the starter kit itself, but if you were just to use RAC as is you'd be able to use Checkbox standalone vs wrapping it in a CheckboxField when needed.

Note that its pretty early days for this HelpText support for these components so the API is still subject to change as the team discusses it some more.

@universse
Copy link

I'm working on something similar too. I think the standalone Checkbox should be used inside CheckboxGroup, which is itself a form field. CheckboxField within CheckboxGroup(Field) would be a little strange I guess. The standalone Checkbox can also be used in other components like Table. So I guess for the starter kit, it still makes sense to have a separate Checkbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 鉁忥笍 To Groom
Development

No branches or pull requests

3 participants