UNPKG

2.52 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { FormLabelProps, ExtendFormLabelTypeMap } from '../FormLabel';
5import { Theme } from '../styles';
6import { InputLabelClasses } from './inputLabelClasses';
7import { OverridableComponent, OverrideProps } from '../OverridableComponent';
8
9export interface InputLabelPropsSizeOverrides {}
10
11export interface InputLabelOwnProps extends Pick<FormLabelProps, 'children'> {
12 /**
13 * Override or extend the styles applied to the component.
14 */
15 classes?: Partial<InputLabelClasses>;
16 color?: FormLabelProps['color'];
17 /**
18 * If `true`, the transition animation is disabled.
19 * @default false
20 */
21 disableAnimation?: boolean;
22 /**
23 * If `true`, the component is disabled.
24 */
25 disabled?: boolean;
26 /**
27 * If `true`, the label is displayed in an error state.
28 */
29 error?: boolean;
30 /**
31 * If `true`, the `input` of this label is focused.
32 */
33 focused?: boolean;
34 /**
35 * If `dense`, will adjust vertical spacing. This is normally obtained via context from
36 * FormControl.
37 */
38 margin?: 'dense';
39 /**
40 * if `true`, the label will indicate that the `input` is required.
41 */
42 required?: boolean;
43 /**
44 * If `true`, the label is shrunk.
45 */
46 shrink?: boolean;
47 /**
48 * The size of the component.
49 * @default 'normal'
50 */
51 size?: OverridableStringUnion<'small' | 'normal', InputLabelPropsSizeOverrides>;
52 /**
53 * The system prop that allows defining system overrides as well as additional CSS styles.
54 */
55 sx?: SxProps<Theme>;
56 /**
57 * The variant to use.
58 */
59 variant?: 'standard' | 'outlined' | 'filled';
60}
61
62export type InputLabelTypeMap<
63 AdditionalProps = {},
64 RootComponent extends React.ElementType = 'label',
65> = ExtendFormLabelTypeMap<{
66 props: AdditionalProps & InputLabelOwnProps;
67 defaultComponent: RootComponent;
68}>;
69
70/**
71 *
72 * Demos:
73 *
74 * - [Text Field](https://mui.com/material-ui/react-text-field/)
75 *
76 * API:
77 *
78 * - [InputLabel API](https://mui.com/material-ui/api/input-label/)
79 * - inherits [FormLabel API](https://mui.com/material-ui/api/form-label/)
80 */
81declare const InputLabel: OverridableComponent<InputLabelTypeMap>;
82
83export type InputLabelProps<
84 RootComponent extends React.ElementType = InputLabelTypeMap['defaultComponent'],
85 AdditionalProps = {},
86> = OverrideProps<InputLabelTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
87 component?: React.ElementType;
88};
89
90export default InputLabel;