UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

41 lines (40 loc) 2.09 kB
import React from "react"; import { IconType } from "../icon"; import { StyledLinkProps } from "./link.style"; import { TagProps } from "../../__internal__/utils/helpers/tags/tags"; export interface LinkProps extends StyledLinkProps, React.AriaAttributes, Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, "download">, TagProps { /** An href for an anchor tag. */ href?: string; /** An icon to display next to the link. */ icon?: IconType; /** Function called when the mouse is clicked. */ onClick?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void; /** Function called when a key is pressed. */ onKeyDown?: (ev: React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void; /** Function called when a mouse down event triggers. */ onMouseDown?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void; /** Child content to render in the link. */ children?: React.ReactNode; /** Target property in which link should open ie: _blank, _self, _parent, _top */ target?: string; /** Aria label for accessibility purposes */ ariaLabel?: string; /** allows to set rel property in <a> tag */ rel?: string; /** @ignore @private internal prop to be set when no aria-label should be specified */ removeAriaLabelOnIcon?: boolean; /** * @private * @internal * @ignore * Sets className for component. INTERNAL USE ONLY. */ className?: string; /** [Legacy] A message to display as a tooltip to the link. * @deprecated The tooltipMessage prop in Link is deprecated and will soon be removed. */ tooltipMessage?: string; /** [Legacy] Positions the tooltip with the link. * @deprecated The tooltipPosition prop in Link is deprecated and will soon be removed. */ tooltipPosition?: "bottom" | "left" | "right" | "top"; } export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>; export default Link;