ToggleControl: Add togglePosition prop for flexible switch placement#74658
ToggleControl: Add togglePosition prop for flexible switch placement#74658shaunandrews wants to merge 1 commit intotrunkfrom
Conversation
Adds a new `togglePosition` prop to ToggleControl that allows positioning the toggle switch at either the start (default) or end of the control, relative to the label. Uses logical positioning (start/end) for RTL support. - Add `togglePosition` prop with 'start' | 'end' values - Update styles with `.is-toggle-end` modifier - Add Storybook stories demonstrating the new prop - Add unit tests for toggle positioning - Expand documentation with design guidelines
|
Size Change: +101 B (0%) Total Size: 3.06 MB
ℹ️ View Unchanged
|
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
Given the patterns that we currently see, I'd say it's better to leave this to custom-composed implementations using the I also feel like we shouldn't be actively promoting this right-aligned pattern in this (and other similar controls like radio and checkbox), as it would encourage inconsistency. Unless we first create guidelines on when they're appropriate. |
|
Makes sense. Thanks! |
Summary
Adds a new
togglePositionprop toToggleControlthat allows positioning the toggle switch at either the start (default) or end of the control, relative to the label.start/end) rather than physical (left/right) for proper RTL language support.is-toggle-endCSS modifier class for stylingTest Plan
togglePosition="end"places toggle after labelnpm run test-unit -- --testPathPattern=toggle-control