Skip to content

Change Proposal: Read-only styling for Switch, Checkbox, and Radio #331

Description

@zoharma

What is being proposed?

A read-only variant for MuiSwitch, MuiCheckbox, and MuiRadio, distinct from disabled.

Why is this needed?

Follow-up from #272 / PR #328, which gave TextField/Select/Autocomplete a dedicated read-only look.

These three controls have no native readOnly support in MUI (unlike text-like inputs), and they currently have only disabled, which mutes the value and drops the control from the tab order even when the value itself still needs to be shown and announced, with no read-only treatment at all.

What will change?

  • Behaviour: enforce read-only via controlled checked + no-op onChange, since native readonly on checkbox/radio inputs doesn't block clicks
  • Accessibility: aria-readonly instead of aria-disabled, keeping the control focusable/announced
  • Visual: likely closer to full saturation than the muted --ds-surface-readonly wash used for text inputs, since the value is meaningful and being displayed, not unavailable

Interface changes (if any)

<Switch readOnly checked={value} />
<Checkbox readOnly checked={value} />
<Radio readOnly checked={value} />

Breaking change?

  • No

Next steps

A maintainer will review this issue.
If accepted, it will be marked as accepted and a PR may then be opened.

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

    needs-triageThis issue needs to be categorised. E.g. accepted, duplicate, wont-do

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions