UNPKG

2.49 kBTypeScriptView Raw
1import * as React from 'react';
2import { OverridableStringUnion } from '@mui/types';
3import { SxProps } from '@mui/system';
4import { Theme } from '..';
5import { OverridableComponent, OverrideProps } from '../OverridableComponent';
6import { DividerClasses } from './dividerClasses';
7
8export interface DividerPropsVariantOverrides {}
9
10export interface DividerOwnProps {
11 /**
12 * Absolutely position the element.
13 * @default false
14 */
15 absolute?: boolean;
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<DividerClasses>;
24 /**
25 * If `true`, a vertical divider will have the correct height when used in flex container.
26 * (By default, a vertical divider will have a calculated height of `0px` if it is the child of a flex container.)
27 * @default false
28 */
29 flexItem?: boolean;
30 /**
31 * If `true`, the divider will have a lighter color.
32 * @default false
33 * @deprecated Use <Divider sx={{ opacity: 0.6 }} /> (or any opacity or color) instead. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
34 */
35 light?: boolean;
36 /**
37 * The component orientation.
38 * @default 'horizontal'
39 */
40 orientation?: 'horizontal' | 'vertical';
41 /**
42 * The system prop that allows defining system overrides as well as additional CSS styles.
43 */
44 sx?: SxProps<Theme>;
45 /**
46 * The text alignment.
47 * @default 'center'
48 */
49 textAlign?: 'center' | 'right' | 'left';
50 /**
51 * The variant to use.
52 * @default 'fullWidth'
53 */
54 variant?: OverridableStringUnion<'fullWidth' | 'inset' | 'middle', DividerPropsVariantOverrides>;
55}
56
57export interface DividerTypeMap<
58 AdditionalProps = {},
59 RootComponent extends React.ElementType = 'hr',
60> {
61 props: AdditionalProps & DividerOwnProps;
62 defaultComponent: RootComponent;
63}
64
65/**
66 *
67 * Demos:
68 *
69 * - [Divider](https://mui.com/material-ui/react-divider/)
70 * - [Lists](https://mui.com/material-ui/react-list/)
71 *
72 * API:
73 *
74 * - [Divider API](https://mui.com/material-ui/api/divider/)
75 */
76declare const Divider: OverridableComponent<DividerTypeMap>;
77
78export type DividerProps<
79 RootComponent extends React.ElementType = DividerTypeMap['defaultComponent'],
80 AdditionalProps = {},
81> = OverrideProps<DividerTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
82 component?: React.ElementType;
83};
84
85export default Divider;