Skip to content

Proposal: Allow on/off label placement on either side of ToggleSwitch #3696

@gabbybilka

Description

@gabbybilka

Proposal: Add alternate label placement to ToggleSwitch

Summary

Apps are interested in a left-positioned on/off label on the ToggleSwitch instead of it appearing on the right. We're thinking of adding additional API to support the choice between a left or right positioned on/off label. However, we would like to hear from the community on whether this would be taken advantage of in your apps or if the proposed approach can be improved upon.

Current ToggleSwitch on/off label position

image

Additional ToggleSwitch on/off label position

image

Rationale

  • If a popular pattern, a built in API to switch between the two modes would increase consistency of exact recommended position

Scope

Capability Priority
A on/off label can appear to the left of the switch itself (in LTR languages) without re-templating or re-styling the ToggleSwitch Must

Implementation exploration

An on/off content positioning boolean

<ToggleSwitch IsOnOffContentPositionOpposite="true" />
// In RTL languages, the OnOffContent is by default to the left of the ToggleSwitch. Setting this to true would mean the OnOffContent would appear to the right of the ToggleSwitch and the header label would still be right-aligned.

An on/off position property with new enum

<ToggleSwitch OnOffContentPosition="Left" />
enum ToggleSwitchOnOffContentPosition 
{
  Right, // default
  Left,
}

Open Questions

  • Are you changing the location of the on/off label in a ToggleSwitch currently?
  • Is there a use to add more positions than merely left or right?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions