@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
78 lines (77 loc) • 2.71 kB
TypeScript
/**
* MSKCC DSM 2021, 2024
*/
import React, { ElementType, ReactNode, HTMLAttributes } from 'react';
import PropTypes from 'prop-types';
import { MskIconId } from '../../Icon/MskIcon';
export declare const TagTypes: readonly ["red", "magenta", "purple", "blue", "cyan", "teal", "green", "gray", "cool-gray", "warm-gray", "high-contrast", "outline", "ghost"];
export type TagType = (typeof TagTypes)[number];
export declare const TagSizes: readonly ["sm", "md", "lg"];
export type TagSize = (typeof TagSizes)[number];
export interface TagProps extends HTMLAttributes<HTMLElement> {
children?: ReactNode;
className?: string;
id?: string;
type?: TagType;
icon?: MskIconId;
renderIcon?: ElementType;
title?: string;
disabled?: boolean;
onClose?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
size?: TagSize;
as?: ElementType;
}
export declare const Tag: {
({ children, className, id, type, icon, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, ...other }: TagProps): JSX.Element;
displayName: string;
propTypes: {
/**
* Provide an alternative tag or component to use instead of the default
* wrapping element
*/
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
/**
* Provide content to be rendered inside of a <Tag>
*/
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/**
* Provide a custom className that is applied to the containing <span>
*/
className: PropTypes.Requireable<string>;
/**
* Specify if the <Tag> is disabled
*/
disabled: PropTypes.Requireable<boolean>;
/**
* Specify the id for the tag.
*/
id: PropTypes.Requireable<string>;
/**
* Click handler for filter tag right icon, default to close button.
*/
onClose: PropTypes.Requireable<(...args: any[]) => any>;
/**
* select msk icon.
*/
icon: PropTypes.Requireable<string>;
/**
* Optional prop to render a custom left icon.
* Can be a React component class
*/
renderIcon: PropTypes.Requireable<object>;
/**
* Specify the size of the Tag. Currently supports either `sm` or
* 'md' (default) sizes.
*/
size: PropTypes.Requireable<string>;
/**
* Text to show on clear filters
*/
title: PropTypes.Requireable<string>;
/**
* Specify the type of the <Tag>
*/
type: PropTypes.Requireable<string>;
};
};
export default Tag;