UNPKG

@carbon/react

Version:

React components for the Carbon Design System

54 lines (53 loc) 1.91 kB
/** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { AnchorHTMLAttributes, AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react'; import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps'; export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> { /** * @description Indicates the element that represents the * current item within a container or set of related * elements. */ 'aria-current'?: AriaAttributes['aria-current']; /** * @description Provide a custom className to be applied to * the containing `<a>` node. */ className?: string; /** * @description Specify if the control should be disabled, or not. */ disabled?: boolean; /** * @description Provide the `href` attribute for the `<a>` node. */ href?: string; /** * @description Specify whether you want the inline version of this control. */ inline?: boolean; /** * A component used to render an icon. */ renderIcon?: ComponentType; /** * Specify the size of the Link. Currently supports either `sm`, `md` (default) or `lg` as an option. */ size?: 'sm' | 'md' | 'lg'; /** * @description Specify the target attribute for the `<a>` node. */ target?: HTMLAttributeAnchorTarget; /** * Specify whether you want the link to receive visited styles after the link has been clicked */ visited?: boolean; } export type LinkProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LinkBaseProps>; type LinkComponent = <T extends React.ElementType = 'a'>(props: LinkProps<T>) => React.ReactElement | any; declare const Link: LinkComponent; export default Link;