mui / mui/material-ui

[InputLabel] does not accept prop "size" in TypeScript

Open
#31,089 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion scope: text field type: expected behavior
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Current behavior 😯

I add the prop size="small" to an InputLabel component, and TypeScript complains:

image

Expected behavior 🤔

TypeScript should accept "size" as a prop, since the prop does what it is supposed to. It is simply not added to the typing.

Steps to reproduce 🕹

Steps:

  1. Add an <InputLabel> component to the app.
  2. Add size="small" as a prop to the component.
  3. The component renders as expected.
  4. TypeScript is not happy.
Context 🔦

No response

Your environment 🌎
`npx @mui/envinfo`

System:
OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Memory: 28.06 GB / 31.23 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/bin/node
npm: 8.1.2 - /usr/local/bin/npm
Managers:
Apt: 2.0.6 - /usr/bin/apt
Utilities:
Make: 4.2.1 - /usr/bin/make
GCC: 9.3.0 - /usr/bin/gcc
Git: 2.25.1 - /usr/bin/git
Virtualization:
Docker: 20.10.9 - /usr/bin/docker
IDEs:
Nano: 4.8 - /usr/bin/nano
Vim: 8.1 - /usr/bin/vim
Languages:
Bash: 5.0.17 - /usr/bin/bash
Perl: 5.30.0 - /usr/bin/perl
Python: 2.7.18 - /usr/bin/python
Python3: 3.8.10 - /usr/bin/python3
Browsers:
Chrome: 98.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the InputLabel component's TypeScript prop definition and inspect how its existing size behavior is represented. Confirm that size="small" is accepted by TypeScript while preserving the current rendered behavior, then run the relevant existing InputLabel checks or tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.