UNPKG

2.48 kBTypeScriptView Raw
1import * as React from 'react';
2import { TooltipPosition } from '../Tooltip';
3export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
4 /** Content rendered inside the label. */
5 children?: React.ReactNode;
6 /** Additional classes added to the label. */
7 className?: string;
8 /** Color of the label. */
9 color?: 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey';
10 /** Variant of the label. */
11 variant?: 'outline' | 'filled';
12 /** Flag indicating the label is compact. */
13 isCompact?: boolean;
14 /** @beta Flag indicating the label is editable. */
15 isEditable?: boolean;
16 /** @beta Additional props passed to the editable label text div. Optionally passing onInput and onBlur callbacks will allow finer custom text input control. */
17 editableProps?: any;
18 /** @beta Callback when an editable label completes an edit. */
19 onEditComplete?: (newText: string) => void;
20 /** @beta Callback when an editable label cancels an edit. */
21 onEditCancel?: (previousText: string) => void;
22 /** Flag indicating the label text should be truncated. */
23 isTruncated?: boolean;
24 /** Position of the tooltip which is displayed if text is truncated */
25 tooltipPosition?: TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
26 /** Icon added to the left of the label text. */
27 icon?: React.ReactNode;
28 /** Close click callback for removable labels. If present, label will have a close button. */
29 onClose?: (event: React.MouseEvent) => void;
30 /** Node for custom close button. */
31 closeBtn?: React.ReactNode;
32 /** Aria label for close button */
33 closeBtnAriaLabel?: string;
34 /** Additional properties for the default close button. */
35 closeBtnProps?: any;
36 /** Href for a label that is a link. If present, the label will change to an anchor element. */
37 href?: string;
38 /** Flag indicating if the label is an overflow label */
39 isOverflowLabel?: boolean;
40 /** Forwards the label content and className to rendered function. Use this prop for react router support.*/
41 render?: ({ className, content, componentRef }: {
42 className: string;
43 content: React.ReactNode;
44 componentRef: any;
45 }) => React.ReactNode;
46}
47export declare const Label: React.FunctionComponent<LabelProps>;
48//# sourceMappingURL=Label.d.ts.map
\No newline at end of file