Skip to content

[material] Add variant prop type in all components #33510

Open
@emlai

Description

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Creating a List component variant causes TypeScript errors when using the variant prop in the variants declaration or at the component usage site.

Suppressing the TypeScript errors allows the variant to be declared and used as expected.

Screen Shot 2022-07-14 at 14 52 39

Expected behavior 🤔

Creating a List component variant is supported in TypeScript.

ListProps should have a declaration for variant, like we have in ButtonProps:

    /**
     * The variant to use.
     * @default 'text'
     */
    variant?: OverridableStringUnion<
      'text' | 'outlined' | 'contained',
      ButtonPropsVariantOverrides
    >;

Steps to reproduce 🕹

Steps:

  1. Create a component variant for List using TypeScript.

CodeSandbox

Context 🔦

We're maintaining a UI library built on top of MUI, and we want to provide a "bordered" List variant for our users. This is is blocking us from doing that.

Your environment 🌎

No response

Metadata

Assignees

No one assigned

    Labels

    design: materialThis is about Material Design, please involve a visual or UX designer in the processdiscussionnew featureNew feature or requestpackage: material-uiSpecific to @mui/material

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions