Skip to content

feat(mat-slide-toggle): setting to justify component (label and switch) using full width #24754

Open
@kimberg

Description

@kimberg

Feature Description

Provide a property or other setting to expand a slide-toggle to fill its horizontal width, so that the label is left-aligned and the switch is right-aligned (for LTR languages).

Use Case

When you have a slide-toggle with a label on the left, it's common, especially in narrow settings panels, so have the label left aligned and the switch itself right-aligned (for LTR languages). So if you have a panel with a bunch of settings, you'd have the labels all left-aligned and all the switches in the same position on the right.

This doesn't seem to be possible with mat-slide-toggle, without reliance on internal implementation details. Currently, even if the mat-slide-toggle is very wide, the label and switch will be packed to the left.

Here are a few examples of the layout I'd like to be able to achieve:

Metadata

Metadata

Assignees

No one assigned

    Labels

    GThis is is related to a Google internal issueP2The issue is important to a large percentage of users, with a workaroundarea: material/checkboxarea: material/radioarea: material/slide-togglefeatureThis issue represents a new feature or feature request rather than a bug or bug fixmaterial specIssue related to the Material Design spec https://material.io/design/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions