Skip to content

Conversation

bsatarnejad
Copy link
Contributor

@bsatarnejad bsatarnejad commented Aug 26, 2025

What are you trying to accomplish?

Pass on and off labels to the Primer toggle switch, so it can receive locale

Screenshots

Before:
toggle switch default

After:
toggle switch with custom status label

Closes #3658

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Pass two strings as the labels for on and off states in toggle switch.

@bsatarnejad bsatarnejad requested a review from a team as a code owner August 26, 2025 09:39
@bsatarnejad bsatarnejad requested a review from TylerJDev August 26, 2025 09:39
Copy link

changeset-bot bot commented Aug 26, 2025

🦋 Changeset detected

Latest commit: 769f07e

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

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

@TylerJDev
Copy link
Member

TylerJDev commented Sep 2, 2025

Hey @bsatarnejad, thanks for the contribution!

I'm looking into the CI, as I'm not too sure why it's failing

Edit: Spoke with the team and this behavior is intentional. We'd want to keep the on/off labels consistent with the switch pattern. Let me know if you have any questions, or if there's a specific use case you think that would benefit from this change! I'll close for now, but feel free to respond here 😁

@TylerJDev TylerJDev closed this Sep 2, 2025
@bsatarnejad
Copy link
Contributor Author

Hi @TylerJDev
Thank you for the clarification. I understand the reasoning for keeping the labels consistent with the ARIA switch pattern.

One consideration I’d like to raise is localization. In multilingual applications, showing the labels only in English (“On/Off”) can feel inconsistent to users in other locales. For example, when the app is set to German, showing “On/Off” in English can feel inconsistent. The semantics would remain the same, but allowing the labels to come from locale files rather than being hardcoded would improve the user experience in localized environments.

Would the team be open to considering translation support, as long as the accessibility and pattern consistency are preserved?

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.

Primer Alpha::ToggleSwitch doesn't support custom status label
2 participants