Skip to content

Chip Group ​

The ChipGroup component can be used to group related chips.

Importing ​

To use the chip group component, first you need to register the component inside the page. You can register the component manually by importing the register function:

ts
import { register } from "@tapsioss/web-components/chip-group";

register(); // Now the chip group component is ready to use!
ts
import { registerChipGroup } from "@tapsioss/web-components";

registerChipGroup(); // Now the chip group component is ready to use!

Also you can automatically register the component by importing it with the following approach:

ts
import "@tapsioss/web-components/chip-group/element";

TIP

If you want to use all the component in your app, you can call registerAll at the root of your project.

ts
import { registerAll } from "@tapsioss/web-components";

registerAll(); // All the components are now available

In the React package, you can easily add the component using the following code:

ts
import { ChipGroup } from "@tapsioss/react-components";

Component Usage ​

html
<tapsi-chip-group></tapsi-chip-group>
tsx
<ChipGroup />

Properties ​

NameAttribute NameDescriptionTypeDefault Value
selectModeselect-modeThe select mode of the chip group."single" | "multiple""multiple"
selectionRequiredselection-requiredDetermines if chip selection is required.booleanfalse
orientationorientationThe orientation of the chip group."horizontal" | "vertical""horizontal"
colscolsDetermines the number of columns of chips the parent will wrap.
This property is only used when orientation is set to "vertical".
number2
labellabelDefines a string value that can be used to set a label
for assistive technologies.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
string""

Slots ​

NameValueDescription
DEFAULT-Default slot for the content of chip.

TIP

The value of slots are available for developer as JavaScript Variables:

ts
// Option 1
import { ChipGroupSlots } from "@tapsioss/web-components";

// Option 2
import { Slots } from "@tapsioss/web-components/chip-group";
ts
// Option 1
import { ChipGroupSlots } from "@tapsioss/react-components";

// Option 2
import { Slots } from "@tapsioss/react-components/ChipGroup";

Events ​

NameDescriptionTypeBubblesCancelable
selectchangeFired when the chip selection state changes.SelectChangeEvent✅❌

TIP

Event details are available as JavaScript variables:

ts
// Option 1
import {
 SelectChangeEvent
} from "@tapsioss/web-components/chip-group";

// Option 2
import {
 ChipGroupSelectChangeEvent
} from "@tapsioss/web-components";

You can have access to the event name using the type property:

ts
// Option 1
element.addEventListener(SelectChangeEvent.type, handleSelectChange);

// Option 2
element.addEventListener(ChipGroupSelectChangeEvent.type, handleSelectChange);

Created with 🧡