Components
Chip

Chip

The Chip component is a versatile UI element, designed to encapsulate and display individual pieces of information in a compact form. This component is commonly used to represent tags, labels, or selected items, providing a visually appealing way to manage and interact with discrete data points.

import

To utilize the Chip component, import it from @vivakits/react-components.

import { VKChip } from "@vivakits/react-components";

Variant

variant prop specifies visual styling of the chip component. The Chip component comes with 2 different variants that can be changed using the variant prop.

Outlined
Filled

Open

The open prop is a boolean prop which indicates if the chip is currently displayed or hidden. By default this is set to true.

Open

Size

The size prop allows for consistent sizing across different parts of your user interface and offers 6 options.

Extra small
Small
Medium
Large
Extra large
Extra extra large

Font size

The fontsize prop allows to set the font size specifically for the text within the chip. There are 6 options offered for this prop.

Extra small
Small
Medium
Large
Extra large
Extra extra large

Color

The color prop defines the background colour of the chip to convey meaningful message with the chip. There are 7 options for color prop.

Primary
Secondary
Success
Danger
Warning
Dark
Light

State

The state prop allows to set the current state or status of the chip. There are 3 options offered for this prop.

Selected
Unselected
Disabled

Rounded

The rounded prop is a boolean prop that indicates whether the chip should have rounded corner or not.

Rounded
Square

Icon

The are two props offerd to show icons on left or right side of the chip. leftIcon allows icon on left side and rightIcon allows icon on right side of the chip. On icon prop, icon component can be passed or a svg can be used directly as the value of the prop.

Left icon
Right icon

Example

Here are some examples of how Badge component can be used with the different props.

Basic
User
Close
person with cameraAvatar
Right Arrow
Up arrow
Search
Clickable
Increase
Decrease

Chip can be used with other component as well. Here is an example of chip being used with Input component.

API Reference

AttributeTypeDescriptionDefault
childrenReactNodeDisplays badge content -
variantfilledoutlinedSpecifies chip visual stylefilled
sizexssmmdlgxl2xlSpecifies chip sizexs
fontSizexssmmdlgxl2xlSpecifies fontsize of label inside chipmd
colorprimarysecondarysuccessdangerwarningdarklightSpecifies chip background or border colorsuccess
stateselectedunselecteddisabledSpecifies current state or status of the chip selected
labeltextDefines the label on the chip -
roundedbooleanDefines if the chip will be rounded or not false
leftIconJSX elementIcon component displayed on the left side of the chip -
rightIconJSX elementIcon component displayed on the right side of the chip -
onClickfunctionDefines functionality on clicking the chip -
onLeftIconClickfunctionDefines functionality on clicking the left icon on chip -
onRightIconClickfunctionDefines functionality on clicking the right icon on chip -
onRightIconClickfunctionDefines functionality on clicking the right icon on chip -
classNameCSSAdditional CSS class(es) to apply to the chip component -
iconClassNameCSSAdditional CSS class(es) to apply to the icon components -
leftIconClassNameCSSAdditional CSS class(es) to apply to the left icon component -
rightIconClassNameCSSAdditional CSS class(es) to apply to the right icon component -
labelClassNameCSSAdditional CSS class(es) to apply to the label text within the chip -