Usage
To display a chip, pass a label
to <Chip>
.
Avatars
To display an avatar with the chip, pass an avatar
prop. It takes an AvatarProps
object.
Icons
Import a FontAwesome icon and pass it to the icon
prop.
Images
Arbitrary images can be displayed by passing in an img
object with src
and alt
properties.
MDN
Dark mode
Set theme
to dark
to use the dark theme.
With image
Click events
To make the chip clickable, pass an onClick
prop. Clickable chips have hover styles and a pointer cursor.
Passing an onRemove
prop will add a remove button to the chip.
API Reference
Chip
Inherits properties from HTMLElement
.
Prop | Type | Default |
label | string | |
avatar | AvatarProps | |
icon | IconProps | |
img | { src: string; alt: string } | |
onClick | MouseEventHandler<HTMLButtonElement> | |
onRemove | MouseEventHandler<HTMLButtonElement> | |
theme | "light" "dark" | "light" |