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: c3b8b91

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 9, 2026 8:03pm

@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

className,
onOptionMouseEnter,
colorScheme = 'light',
required,
Copy link
Contributor

@jorgemoya jorgemoya Jan 9, 2026

Choose a reason for hiding this comment

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

🚨 Since you are destructuring the required prop and it is no longer contained within the ...rest property, this will break the component since RadioGroupPrimitive.Root also needs required for form validation.

So to fix this, simply pass required to RadioGroupPrimitive.Root.

This same issue applies to all other form components.

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 each of the components that referenced ...rest to additionally pass the required prop

@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

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