Skip to content

BBBToggle: label at the start and the switch at the end of a full-width row #112

Closed

Description

@AtilaU19

Is your feature request related to a problem? Please describe.
A settings list often puts each label at the start of the row and its switch at the end, aligned with the other rows. BBBToggle can't lay itself out that way.

With textPosition="left", the label sits before the switch, but the wrapper packs both to the end (justify-content: end) and right-aligns the label (align-items: end). In a full-width column the label ends up hugging the switch, far from the row's start. A label with helper text shows both lines right-aligned.

The extra props don't help either: they go to the MUI Switch, not to the wrapper. The consumer's only option is to override the library's styles from a parent with descendant selectors (& > div, & > div > label). Those selectors depend on the library's internal markup.

The case in point is the BigBlueButton 4.1 pre-flight room mode summary, which lists editable room settings (join muted, public chat, whiteboard for everyone) next to selects whose titles start at the left edge. The design has the label at the start and the switch at the end.

Describe the solution you'd like
A way to spread the row, for example a fullWidth?: boolean prop. Together with textPosition="left", it would:

  • stretch the wrapper to its container and put the label at the start and the switch at the end (justify-content: space-between);
  • start-align the label and the helper text.

Leaving it unset keeps today's layout.

Describe alternatives you've considered

  • Change what left does. It's simpler, but it would change every current consumer's layout.
  • Forward className/style to the wrapper. It's useful in general, but every consumer would rewrite the same layout.

Affected component(s)
BBBToggle

Proposed API / Usage Example

<BBBToggle
  label="Join muted"
  helperText="Joining users are muted by default"
  textPosition="left"
  fullWidth
  checked={joinMuted}
  onChange={(_, checked) => setJoinMuted(checked)}
/>

Additional context
Seen on 0.8.0. The toggle styles are the same in 0.9.0 and on main (4cf6e137a6).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions