UNPKG

2.79 kBTypeScriptView Raw
1import * as React from 'react';
2import { OverridableStringUnion } from '@mui/types';
3import { SxProps } from '@mui/system';
4import { PropTypes, Theme } from '..';
5import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
6import { OverrideProps } from '../OverridableComponent';
7import { FabClasses } from './fabClasses';
8
9export interface FabPropsVariantOverrides {}
10
11export interface FabPropsSizeOverrides {}
12
13export interface FabPropsColorOverrides {}
14
15export interface FabOwnProps {
16 /**
17 * The content of the component.
18 */
19 children?: React.ReactNode;
20 /**
21 * Override or extend the styles applied to the component.
22 */
23 classes?: Partial<FabClasses>;
24 /**
25 * The color of the component.
26 * It supports both default and custom theme colors, which can be added as shown in the
27 * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
28 * @default 'default'
29 */
30 color?: OverridableStringUnion<
31 PropTypes.Color | 'success' | 'error' | 'info' | 'warning',
32 FabPropsColorOverrides
33 >;
34 /**
35 * If `true`, the component is disabled.
36 * @default false
37 */
38 disabled?: boolean;
39 /**
40 * If `true`, the keyboard focus ripple is disabled.
41 * @default false
42 */
43 disableFocusRipple?: boolean;
44 /**
45 * If `true`, the ripple effect is disabled.
46 */
47 disableRipple?: boolean;
48 /**
49 * The URL to link to when the button is clicked.
50 * If defined, an `a` element will be used as the root node.
51 */
52 href?: string;
53 /**
54 * The size of the component.
55 * `small` is equivalent to the dense button styling.
56 * @default 'large'
57 */
58 size?: OverridableStringUnion<'small' | 'medium' | 'large', FabPropsSizeOverrides>;
59 /**
60 * The variant to use.
61 * @default 'circular'
62 */
63 variant?: OverridableStringUnion<'circular' | 'extended', FabPropsVariantOverrides>;
64 /**
65 * The system prop that allows defining system overrides as well as additional CSS styles.
66 */
67 sx?: SxProps<Theme>;
68}
69
70export type FabTypeMap<
71 AdditionalProps = {},
72 RootComponent extends React.ElementType = 'button',
73> = ExtendButtonBaseTypeMap<{
74 props: AdditionalProps & FabOwnProps;
75 defaultComponent: RootComponent;
76}>;
77
78/**
79 *
80 * Demos:
81 *
82 * - [Floating Action Button](https://mui.com/material-ui/react-floating-action-button/)
83 *
84 * API:
85 *
86 * - [Fab API](https://mui.com/material-ui/api/fab/)
87 * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
88 */
89declare const Fab: ExtendButtonBase<FabTypeMap>;
90
91export type FabProps<
92 RootComponent extends React.ElementType = FabTypeMap['defaultComponent'],
93 AdditionalProps = {},
94> = OverrideProps<FabTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
95 component?: React.ElementType;
96};
97
98export default Fab;