Skip to content

Conversation

@jamesqquick
Copy link
Contributor

@jamesqquick jamesqquick commented Jan 8, 2026

What/Why?

Added (optional) text to optional fields in forms so that it's clear which ones are required vs not

Testing

Open the /register route and see a combination of required and optional fields.

image

Migration

The new required props are optional, so they are backwards compatible. However, this does mean that the (optional) text will now show up on fields that aren't explicitly marked as required by passing the required prop to the Label component.

CATALYST-1672

…ents

- Introduced a `required` prop to the Label component to indicate mandatory fields.
- Updated Input, Textarea, NumberInput, Select, Checkbox, RadioGroup, and other form components to utilize the new `required` prop for better accessibility and user experience.
@jamesqquick jamesqquick requested a review from a team as a code owner January 8, 2026 16:22
@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2026

🦋 Changeset detected

Latest commit: 527be2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
catalyst Ready Ready Preview, Comment Jan 12, 2026 8:51pm

@jamesqquick jamesqquick marked this pull request as draft January 8, 2026 16:22
@jamesqquick jamesqquick marked this pull request as ready for review January 8, 2026 18:13
Copy link
Contributor

@matthewvolk matthewvolk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you generate a changeset for this? You can run pnpm changeset from the project root and walk through the prompts. Just include a 1-2 sentence description of the feature, and copy/paste the migration guide from your PR description and the changeset should be good to commit and add to this PR 👍

@jamesqquick
Copy link
Contributor Author

Added translations and a changeset cc @jorgemoya @matthewvolk

Copy link
Contributor

@jorgemoya jorgemoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as request changes only because there's an oversight that will break form components until fixed.

Comment on lines 611 to 612
"Form": {
"optional": "valgfri"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These translated labels get auto generated every Monday, so for future references as long as we have the en label that is fine. next-intl will fallback to the en label if there is no available translation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to only keep the english version

@jamesqquick
Copy link
Contributor Author

Removed all translations except for english and made sure to pass required prop down for any component that referenced ...rest

id={id !== undefined ? `${id}-label` : `${generatedId}-label`}
>
{label}
{!props.required && <span className="ml-1 normal-case">(optional)</span>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not using the translated labels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this text from checkbox since inherently it doesn't make sense. Checkboxes are inherently optinoal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkbox fields can still be required by the Bigcommerce GQL api.

Thinking of general cases, a ToS checkbox would be required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a difference though between requiring a value and requiring that the box be checked right? Technically, an unchecked box is still a valid user input? Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't an unckecked checkbox looked at as a boolean false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgemoya updated to pass field.required to CheckboxGroup which handles displaying the label using the Label component for a group of individual Checkbox components. This matches the Stencil functionality. The difference is that we display optional text instead of required text.

CleanShot 2026-01-12 at 14 49 01@2x

CleanShot 2026-01-12 at 14 49 53@2x

}
},
"Form": {
"optional": "optional"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍹Should punctuation e.g., (, ) be included in next-intl strings? Wondering if other languages use a different convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered about that. Not that I know of. I also wouldn't think the automation we have set up would have an automatic/appropriate translation if that was the case. I wouldn't think our automatic translations would understand the use case just based on the text enough to make a decision?

@jamesqquick jamesqquick added this pull request to the merge queue Jan 12, 2026
Merged via the queue into canary with commit 52ee85e Jan 12, 2026
8 checks passed
@jamesqquick jamesqquick deleted the feat_add_required_indicators_to_form_fields branch January 12, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants