Chip Vue Component

Chips (Tags) Vue component represent complex entities in small blocks, such as a contact. They can contain a photo, short title string, and brief information

Chip Components

There are following components included:

  • Chip

Chip Props

NameTypeDefaultDescription
colorsobject

Object with Tailwind CSS colors classes

colors.bgstring'bg-black bg-opacity-10 dark:bg-white dark:bg-opacity-10'

Chip bg color

colors.borderstring'border-black border-opacity-10 dark:border-white dark:border-opacity-10'

Chip border color

colors.textstring'text-current'

Chip text color

componentstring'div'

Component's HTML Element

deleteButtonbooleanfalse

Defines whether the Chip has additional "delete" button or not

outlinebooleanfalse

Makes chip outline

Chip Events

NameTypeDescription
deletefunction(e)

Event will be triggered on Chip delete button click

Chip Slots

NameDescription
media

Content of the chip media area (e.g. icon)

Examples

Chips.vue
<template>
<twm-page>
<twm-navbar title="Chips" />
<twm-block-title>Chips With Text</twm-block-title>
<twm-block strong>
<twm-chip class="m-0.5">Example Chip</twm-chip>
<twm-chip class="m-0.5">Another Chip</twm-chip>
<twm-chip class="m-0.5">One More Chip</twm-chip>
<twm-chip class="m-0.5">Fourth Chip</twm-chip>
<twm-chip class="m-0.5">Last One</twm-chip>
</twm-block>
<twm-block-title>Outline Chips</twm-block-title>
<twm-block strong>
<twm-chip outline class="m-0.5"> Example Chip </twm-chip>
<twm-chip outline class="m-0.5"> Another Chip </twm-chip>
<twm-chip outline class="m-0.5"> One More Chip </twm-chip>
<twm-chip outline class="m-0.5"> Fourth Chip </twm-chip>
<twm-chip outline class="m-0.5"> Last One </twm-chip>
</twm-block>
<twm-block-title>Contact Chips</twm-block-title>
<twm-block strong>
<twm-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
</template>
Jane Doe
</twm-chip>
<twm-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
</template>
John Doe
</twm-chip>
<twm-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Adam Smith
</twm-chip>
</twm-block>
<twm-block-title>Deletable Chips / Tags</twm-block-title>
<twm-block strong>
<twm-chip class="m-0.5" delete-button @delete="onDelete">
Example Chip
</twm-chip>
<twm-chip class="m-0.5" delete-button @delete="onDelete">
<template #media>
<img
alt="avatar"
class="h-7 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Adam Smith
</twm-chip>
</twm-block>
<twm-block-title class="bg-b bg-b">Color Chips</twm-block-title>
<twm-block strong>
<twm-chip
class="m-0.5"
:colors="{ bg: 'bg-red-500', text: 'text-white' }"
>
Red Chip
</twm-chip>
<twm-chip
class="m-0.5"
:colors="{ bg: 'bg-green-500', text: 'text-white' }"
>
Green Chip
</twm-chip>
<twm-chip
class="m-0.5"
:colors="{ bg: 'bg-blue-500', text: 'text-white' }"
>
Blue Chip
</twm-chip>
<twm-chip
class="m-0.5"
:colors="{ bg: 'bg-yellow-500', text: 'text-white' }"
>
Yellow Chip
</twm-chip>
<twm-chip
class="m-0.5"
:colors="{ bg: 'bg-pink-500', text: 'text-white' }"
>
Pink Chip
</twm-chip>
<twm-chip
class="m-0.5"
outline
:colors="{ border: 'border-red-500', text: 'text-red-500' }"
>
Red Chip
</twm-chip>
<twm-chip
class="m-0.5"
outline
:colors="{ border: 'border-green-500', text: 'text-green-500' }"
>
Green Chip
</twm-chip>
<twm-chip
class="m-0.5"
outline
:colors="{ border: 'border-blue-500', text: 'text-blue-500' }"
>
Blue Chip
</twm-chip>
<twm-chip
class="m-0.5"
outline
:colors="{ border: 'border-yellow-500', text: 'text-yellow-500' }"
>
Yellow Chip
</twm-chip>
<twm-chip
class="m-0.5"
outline
:colors="{ border: 'border-pink-500', text: 'text-pink-500' }"
>
Pink Chip
</twm-chip>
</twm-block>
</twm-page>
</template>
<script>
import {
twmPage,
twmNavbar,
twmNavbarBackLink,
twmChip,
twmBlock,
twmBlockTitle,
} from 'tailwind-mobile/vue';
export default {
components: {
twmPage,
twmNavbar,
twmNavbarBackLink,
twmChip,
twmBlock,
twmBlockTitle,
},
setup() {
const onDelete = () => {
console.log('Delete Chip');
};
return {
onDelete,
};
},
};
</script>
Code licensed under MIT.
2021 © Tailwind Mobile by nolimits4web.