UNPKG

@trail-ui/react

Version:
52 lines (49 loc) 1.84 kB
import { ChipVariantProps, SlotsToClasses, ChipSlots } from '@trail-ui/theme'; import react__default, { HTMLAttributes } from 'react'; import { PressEvent } from 'react-aria'; import { ContextValue } from 'react-aria-components'; interface ChipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'>, ChipVariantProps { elementType?: string; /** * Avatar to be rendered in the left side of the chip. */ avatar?: react__default.ReactNode; /** * Element to be rendered in the left side of the chip. * this props overrides the `avatar` prop. */ startContent?: react__default.ReactNode; /** * Element to be rendered in the right side of the chip. * if you pass this prop and the `onClose` prop, the passed element * will have the close button props and it will be rendered instead of the * default close button. */ endContent?: react__default.ReactNode; /** * Classes object to style the chip and its children. */ classNames?: SlotsToClasses<ChipSlots>; /** * Callback fired when the chip is closed. if you pass this prop, * the chip will display a close button (endContent). * @param e PressEvent */ onClose?: (e: PressEvent) => void; /** * If `true`, the chip will be displayed with a border. * @default false */ isBordered?: boolean; /** * If `true`, the chip will be read only. * @default false */ isReadOnly?: boolean; } interface ChipContextValue extends ChipProps { isDisabled?: boolean; } declare const ChipContext: react__default.Context<ContextValue<ChipContextValue, HTMLDivElement>>; declare const _Chip: react__default.ForwardRefExoticComponent<ChipProps & react__default.RefAttributes<HTMLDivElement>>; export { _Chip as Chip, ChipContext, ChipProps };