Chip     

The Chip component is basically a simple UI block entity, representing for example more advanced underlying data, such as a contact, in a compact way.

Chips can contain entities such as an avatar, text or an icon, optionally having a pointer too. They can also be closed or removed if configured so.

Basic Usage

Some basic examples:

<!-- icon on left side -->
<q-chip icon="alarm" color="primary">
q-chip
</q-chip>

<!-- icon on right side -->
<q-chip icon-right="alarm" color="primary">
q-chip
</q-chip>

<!-- avatar on left side -->
<q-chip avatar="/statics/some.png" color="primary">
q-chip
</q-chip>

Vue Properties

There are a number of properties available:

Vue PropertyTypeDescription
floatingBooleanAllows the chip to float over other elements.
tagBooleanMakes it a “tag” type.
detailBooleanHighlights the area on the right (icon or avatar), should there be one.
iconStringIcon for left side.
icon-rightStringIcon for right side.
avatarStringURL pointing to statics folder for an image which gets placed on left side.
smallBooleanReduces the size of the chip. Makes it compact.
squareBooleanGives the chip right-angled corners. Rounded corners are default.
pointingStringAdds a carat to the chip, pointing either up, right, down or left.
colorStringThe color the chip should be.
closableBooleanAdds a close button to the right of the chip, which when clicked, will emit @close event.

Vue Events

Vue PropertyDescription
@closeThe close button has been clicked/tapped.
@clickChip has been clicked/tapped outside of close button.

When using closable property a close button will be displayed on the right side. When clicking/tapping on the button the @close event will be triggered. This does not removes the chip by itself. You will have to handle it yourself.

The two events fire independently but not both simultaneously, depending on where the user has clicked/tapped (on close button or anywhere else within the Chip).

More Examples

You can add the ability to close the chip too.

<q-chip closable color="red">
Joe
</q-chip>

You can also use a chip to label a button.

<q-btn class="light relative-position">
Inbox
<q-chip floating color="primary">22</q-chip>
</q-btn>

You can also use chips as pointing labels.

<q-chip pointing="up" color="primary">
Pointing Up
</q-chip>

You can create advanced label chips, with an avatar/image and a closeable button to delete the chip.

<q-chip closable avatar="/statics/some.png" color="red">
Joe
</q-chip>

You can also create chips that look like tags.

<q-chip tag color="secondary" icon-right="mail">
New
</q-chip>

This chip highlights the icon by using the detail property.

<q-chip tag color="secondary" detail icon="mail">
10 emails
</q-chip>

One more example where we add a shadow to a chip:

<q-chip class="shadow-1" square color="primary">10k</q-chip>