@primer/components
Version:
Primer react components
32 lines (31 loc) • 1.21 kB
TypeScript
/// <reference types="react" />
import { SxProp } from '../sx';
export declare type TokenSizeKeys = 'small' | 'medium' | 'large' | 'extralarge';
export declare const tokenSizes: Record<TokenSizeKeys, string>;
export declare const defaultTokenSize: TokenSizeKeys;
export interface TokenBaseProps extends Omit<React.HTMLProps<HTMLSpanElement | HTMLButtonElement | HTMLAnchorElement>, 'size' | 'id'> {
as?: 'button' | 'a' | 'span';
/**
* The function that gets called when a user clicks the remove button, or keys "Backspace" or "Delete" when focused on the token
*/
onRemove?: () => void;
/**
* Whether the token is selected
*/
isSelected?: boolean;
/**
* The text label inside the token
*/
text: string;
/**
* A unique identifier that can be associated with the token
*/
id?: number | string;
/**
* Which size the token will be rendered at
*/
size?: TokenSizeKeys;
}
export declare const isTokenInteractive: ({ as, onClick, onFocus, tabIndex }: TokenBaseProps) => boolean;
declare const TokenBase: import("styled-components").StyledComponent<"span", any, TokenBaseProps & SxProp, never>;
export default TokenBase;