@coconut-software/ui
Version:
React components for faster and easier web development.
30 lines (29 loc) • 1.13 kB
TypeScript
import type { PropsWithChildren, ReactNode } from 'react';
import type { AriaLiveRole } from '../utilities/aria';
interface BaseBadgeProps {
'aria-label'?: string;
color?: BadgeColor;
value?: ReactNode;
invisible?: boolean;
max?: number;
overlap?: BadgeOverlap;
role?: AriaLiveRole.Alert | AriaLiveRole.Status;
showZero?: boolean;
variant?: BadgeVariant;
position?: {
x?: BadgeXPosition;
y?: BadgeYPosition;
};
}
type PresentationBadgeProps = {
'aria-label'?: never;
role: AriaLiveRole.Presentation;
} & Omit<BaseBadgeProps, 'aria-label' | 'role'>;
type BadgeProps = BaseBadgeProps | PresentationBadgeProps;
type BadgeColor = 'default' | 'error' | 'primary' | 'secondary';
type BadgeXPosition = 'left' | 'right';
type BadgeYPosition = 'top' | 'bottom';
type BadgeOverlap = 'circle' | 'rectangle';
type BadgeVariant = 'default' | 'dot';
declare function Badge({ 'aria-label': label, children, color, value, invisible, max, overlap, role, showZero, variant, position, }: PropsWithChildren<BadgeProps>): JSX.Element;
export default Badge;