UNPKG

2.16 kBTypeScriptView Raw
1import * as React from 'react';
2import { DistributiveOmit } from '@mui/types';
3import { SxProps } from '@mui/system';
4import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5import { Theme } from '../styles';
6import { TypographyOwnProps } from '../Typography';
7import { LinkClasses } from './linkClasses';
8
9export interface LinkOwnProps extends DistributiveOmit<LinkBaseProps, 'classes'> {
10 /**
11 * The content of the component.
12 */
13 children?: React.ReactNode;
14 /**
15 * Override or extend the styles applied to the component.
16 */
17 classes?: Partial<LinkClasses>;
18 /**
19 * The color of the link.
20 * @default 'primary'
21 */
22 color?: TypographyOwnProps['color'];
23 /**
24 * The system prop that allows defining system overrides as well as additional CSS styles.
25 */
26 sx?: SxProps<Theme>;
27 /**
28 * `classes` prop applied to the [`Typography`](https://mui.com/material-ui/api/typography/) element.
29 */
30 TypographyClasses?: TypographyOwnProps['classes'];
31 /**
32 * Controls when the link should have an underline.
33 * @default 'always'
34 */
35 underline?: 'none' | 'hover' | 'always';
36 /**
37 * Applies the theme typography styles.
38 * @default 'inherit'
39 */
40 variant?: TypographyOwnProps['variant'];
41}
42
43export interface LinkTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'a'> {
44 props: AdditionalProps & LinkOwnProps;
45 defaultComponent: RootComponent;
46}
47
48/**
49 *
50 * Demos:
51 *
52 * - [Breadcrumbs](https://mui.com/material-ui/react-breadcrumbs/)
53 * - [Links](https://mui.com/material-ui/react-link/)
54 *
55 * API:
56 *
57 * - [Link API](https://mui.com/material-ui/api/link/)
58 * - inherits [Typography API](https://mui.com/material-ui/api/typography/)
59 */
60declare const Link: OverridableComponent<LinkTypeMap>;
61
62export type LinkBaseProps = DistributiveOmit<
63 TypographyOwnProps,
64 'children' | 'color' | 'variant' | 'classes'
65>;
66
67export type LinkProps<
68 RootComponent extends React.ElementType = LinkTypeMap['defaultComponent'],
69 AdditionalProps = {},
70> = OverrideProps<LinkTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
71 component?: React.ElementType;
72};
73
74export default Link;