@carbon/react
Version:
React components for the Carbon Design System
58 lines (57 loc) • 1.7 kB
TypeScript
/**
* 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, { MouseEventHandler } from 'react';
import { PolymorphicProps } from '../../types/common';
import { SIZES } from './Tag';
declare const TYPES: {
red: string;
magenta: string;
purple: string;
blue: string;
cyan: string;
teal: string;
green: string;
gray: string;
'cool-gray': string;
'warm-gray': string;
};
export interface OperationalTagBaseProps {
/**
* Provide a custom className that is applied to the containing <span>
*/
className?: string;
/**
* Specify if the `OperationalTag` is disabled
*/
disabled?: boolean;
/**
* Specify the id for the OperationalTag.
*/
id?: string;
/**
* A component used to render an icon.
*/
renderIcon?: React.ElementType;
onClick?: MouseEventHandler;
/**
* Specify the size of the Tag. Currently supports either `sm`,
* `md` (default) or `lg` sizes.
*/
size?: keyof typeof SIZES;
/**
* Provide text to be rendered inside of a the tag.
*/
text?: string;
/**
* Specify the type of the `Tag`
*/
type?: keyof typeof TYPES;
}
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
declare const OperationalTag: React.ForwardRefExoticComponent<Omit<OperationalTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
export declare const types: string[];
export default OperationalTag;