UNPKG

2.4 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
5import { PropTypes, Theme } from '..';
6import { AppBarClasses } from './appBarClasses';
7import { ExtendPaperTypeMap } from '../Paper/Paper';
8
9export interface AppBarPropsColorOverrides {}
10
11export interface AppBarOwnProps {
12 /**
13 * Override or extend the styles applied to the component.
14 */
15 classes?: Partial<AppBarClasses>;
16 /**
17 * The color of the component.
18 * It supports both default and custom theme colors, which can be added as shown in the
19 * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
20 * @default 'primary'
21 */
22 color?: OverridableStringUnion<
23 PropTypes.Color | 'transparent' | 'error' | 'info' | 'success' | 'warning',
24 AppBarPropsColorOverrides
25 >;
26 /**
27 * If true, the `color` prop is applied in dark mode.
28 * @default false
29 */
30 enableColorOnDark?: boolean;
31 /**
32 * The positioning type. The behavior of the different options is described
33 * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).
34 * Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
35 * @default 'fixed'
36 */
37 position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative';
38 /**
39 * The system prop that allows defining system overrides as well as additional CSS styles.
40 */
41 sx?: SxProps<Theme>;
42}
43
44export type AppBarTypeMap<
45 AdditionalProps = {},
46 RootComponent extends React.ElementType = 'header',
47> = ExtendPaperTypeMap<
48 {
49 props: AdditionalProps & AppBarOwnProps;
50 defaultComponent: RootComponent;
51 },
52 'position' | 'color' | 'classes'
53>;
54
55/**
56 *
57 * Demos:
58 *
59 * - [App Bar](https://mui.com/material-ui/react-app-bar/)
60 *
61 * API:
62 *
63 * - [AppBar API](https://mui.com/material-ui/api/app-bar/)
64 * - inherits [Paper API](https://mui.com/material-ui/api/paper/)
65 */
66
67declare const AppBar: OverridableComponent<AppBarTypeMap>;
68
69export type AppBarProps<
70 RootComponent extends React.ElementType = AppBarTypeMap['defaultComponent'],
71 AdditionalProps = {},
72> = OverrideProps<AppBarTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
73 component?: React.ElementType;
74};
75
76export default AppBar;