UNPKG

2.15 kBTypeScriptView Raw
1import * as React from 'react';
2import { ResponsiveStyleValue, SxProps, SystemProps } from '@mui/system';
3import { OverrideProps, OverridableComponent } from '../OverridableComponent';
4import { Theme } from '../styles/createTheme';
5
6export interface StackOwnProps extends SystemProps<Theme> {
7 /**
8 * The content of the component.
9 */
10 children?: React.ReactNode;
11 /**
12 * Defines the `flex-direction` style property.
13 * It is applied for all screen sizes.
14 * @default 'column'
15 */
16 direction?: ResponsiveStyleValue<'row' | 'row-reverse' | 'column' | 'column-reverse'>;
17 /**
18 * Defines the space between immediate children.
19 * @default 0
20 */
21 spacing?: ResponsiveStyleValue<number | string>;
22 /**
23 * Add an element between each child.
24 */
25 divider?: React.ReactNode;
26 /**
27 * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
28 *
29 * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
30 * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
31 *
32 * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
33 * @default false
34 */
35 useFlexGap?: boolean;
36 /**
37 * The system prop, which allows defining system overrides as well as additional CSS styles.
38 */
39 sx?: SxProps<Theme>;
40}
41
42export interface StackTypeMap<
43 AdditionalProps = {},
44 RootComponent extends React.ElementType = 'div',
45> {
46 props: AdditionalProps & StackOwnProps;
47 defaultComponent: RootComponent;
48}
49/**
50 *
51 * Demos:
52 *
53 * - [Stack](https://mui.com/material-ui/react-stack/)
54 *
55 * API:
56 *
57 * - [Stack API](https://mui.com/material-ui/api/stack/)
58 */
59declare const Stack: OverridableComponent<StackTypeMap>;
60
61export type StackProps<
62 RootComponent extends React.ElementType = StackTypeMap['defaultComponent'],
63 AdditionalProps = {},
64> = OverrideProps<StackTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
65 component?: React.ElementType;
66};
67
68export default Stack;