UNPKG

3.07 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5import { Theme } from '..';
6import { ButtonGroupClasses } from './buttonGroupClasses';
7
8export interface ButtonGroupPropsColorOverrides {}
9export interface ButtonGroupPropsVariantOverrides {}
10export interface ButtonGroupPropsSizeOverrides {}
11
12export interface ButtonGroupOwnProps {
13 /**
14 * The content of the component.
15 */
16 children?: React.ReactNode;
17 /**
18 * Override or extend the styles applied to the component.
19 */
20 classes?: Partial<ButtonGroupClasses>;
21 /**
22 * The color of the component.
23 * It supports both default and custom theme colors, which can be added as shown in the
24 * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
25 * @default 'primary'
26 */
27 color?: OverridableStringUnion<
28 'inherit' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
29 ButtonGroupPropsColorOverrides
30 >;
31 /**
32 * If `true`, the component is disabled.
33 * @default false
34 */
35 disabled?: boolean;
36 /**
37 * If `true`, no elevation is used.
38 * @default false
39 */
40 disableElevation?: boolean;
41 /**
42 * If `true`, the button keyboard focus ripple is disabled.
43 * @default false
44 */
45 disableFocusRipple?: boolean;
46 /**
47 * If `true`, the button ripple effect is disabled.
48 * @default false
49 */
50 disableRipple?: boolean;
51 /**
52 * If `true`, the buttons will take up the full width of its container.
53 * @default false
54 */
55 fullWidth?: boolean;
56 /**
57 * The component orientation (layout flow direction).
58 * @default 'horizontal'
59 */
60 orientation?: 'vertical' | 'horizontal';
61 /**
62 * The size of the component.
63 * `small` is equivalent to the dense button styling.
64 * @default 'medium'
65 */
66 size?: OverridableStringUnion<'small' | 'medium' | 'large', ButtonGroupPropsSizeOverrides>;
67 /**
68 * The variant to use.
69 * @default 'outlined'
70 */
71 variant?: OverridableStringUnion<
72 'text' | 'outlined' | 'contained',
73 ButtonGroupPropsVariantOverrides
74 >;
75 /**
76 * The system prop that allows defining system overrides as well as additional CSS styles.
77 */
78 sx?: SxProps<Theme>;
79}
80
81export interface ButtonGroupTypeMap<
82 AdditionalProps = {},
83 RootComponent extends React.ElementType = 'div',
84> {
85 props: AdditionalProps & ButtonGroupOwnProps;
86 defaultComponent: RootComponent;
87}
88
89/**
90 *
91 * Demos:
92 *
93 * - [Button Group](https://mui.com/material-ui/react-button-group/)
94 *
95 * API:
96 *
97 * - [ButtonGroup API](https://mui.com/material-ui/api/button-group/)
98 */
99declare const ButtonGroup: OverridableComponent<ButtonGroupTypeMap>;
100
101export type ButtonGroupProps<
102 RootComponent extends React.ElementType = ButtonGroupTypeMap['defaultComponent'],
103 AdditionalProps = {},
104> = OverrideProps<ButtonGroupTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
105 component?: React.ElementType;
106};
107
108export default ButtonGroup;