2022-09-09 20:41:18 +00:00
|
|
|
<template>
|
2022-09-12 13:27:56 +00:00
|
|
|
<ClientOnly>
|
2022-09-14 14:26:41 +00:00
|
|
|
<AppDoc name="ChipDemo" :sources="sources" github="chip/ChipDemo.vue">
|
|
|
|
<h5>Import via Module</h5>
|
|
|
|
<pre v-code.script><code>
|
2022-09-09 20:41:18 +00:00
|
|
|
import Chip from 'primevue/chip';
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Import via CDN</h5>
|
|
|
|
<pre v-code><code>
|
2022-09-09 20:41:18 +00:00
|
|
|
<script src="https://unpkg.com/primevue@^3/core/core.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/primevue@^3/chip/chip.min.js"></script>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Getting Started</h5>
|
|
|
|
<p>Chip can display labels, icons and images.</p>
|
|
|
|
<pre v-code><code>
|
2022-09-09 20:41:18 +00:00
|
|
|
<Chip label="Text Only" />
|
|
|
|
<Chip label="Text with icon" icon="pi pi-check" />
|
|
|
|
<Chip label="Text with image" image="user.png" />
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Removable</h5>
|
|
|
|
<p>Setting <i>removable</i> property displays an icon to close the chip, the optional <i>remove</i> event is available to get notified when a chip is hidden.</p>
|
|
|
|
<pre v-code><code>
|
2022-09-09 20:41:18 +00:00
|
|
|
<Chip label="Text" removable />
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Templating</h5>
|
|
|
|
<p>Content can easily be customized with the default slot instead of using the built-in modes.</p>
|
|
|
|
<pre v-code><code>
|
2022-09-09 20:41:18 +00:00
|
|
|
<Chip>
|
|
|
|
Content
|
|
|
|
</Chip>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Properties</h5>
|
|
|
|
<p>Any property as style and class are passed to the main container element. Following are the additional properties to configure the component.</p>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Default</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>label</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Defines the text to display.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>icon</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Defines the icon to display.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>image</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Defines the image to display.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>removable</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>false</td>
|
|
|
|
<td>Whether to display a remove icon.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>removeIconClass</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>pi pi-times-circle</td>
|
|
|
|
<td>Icon of the remove element.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2022-09-09 20:41:18 +00:00
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Events</h5>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Parameters</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>remove</td>
|
|
|
|
<td>event: Browser event</td>
|
|
|
|
<td>Callback to invoke when a chip is removed.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2022-09-09 20:41:18 +00:00
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Styling</h5>
|
|
|
|
<p>Following is the list of structural style classes, for theming classes visit <nuxt-link to="/theming">theming</nuxt-link> page.</p>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Element</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>p-chip</td>
|
|
|
|
<td>Container element.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-chip-image</td>
|
|
|
|
<td>Container element in image mode.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-chip-text</td>
|
|
|
|
<td>Text of the chip.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-chip-remove-icon</td>
|
|
|
|
<td>Remove icon.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2022-09-09 20:41:18 +00:00
|
|
|
|
2022-09-14 14:26:41 +00:00
|
|
|
<h5>Dependencies</h5>
|
|
|
|
<p>None.</p>
|
|
|
|
</AppDoc>
|
|
|
|
</ClientOnly>
|
2022-09-09 20:41:18 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
sources: {
|
|
|
|
'options-api': {
|
|
|
|
tabName: 'Options API Source',
|
|
|
|
content: `
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h5>Basic</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Action" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Comedy" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Mystery" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Thriller" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Icon</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Facebook" icon="pi pi-facebook" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Google" icon="pi pi-google" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Microsoft" icon="pi pi-microsoft" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Image</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Amy Elsner" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Asiya Javayant" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Styling</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Action" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="custom-chip mb-2" removable />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
}
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.p-chip.custom-chip {
|
|
|
|
background: var(--primary-color);
|
|
|
|
color: var(--primary-color-text);
|
|
|
|
}
|
|
|
|
</style>`
|
|
|
|
},
|
|
|
|
'composition-api': {
|
|
|
|
tabName: 'Composition API Source',
|
|
|
|
content: `
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h5>Basic</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Action" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Comedy" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Mystery" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Thriller" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Icon</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Facebook" icon="pi pi-facebook" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Google" icon="pi pi-google" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Microsoft" icon="pi pi-microsoft" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Image</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Amy Elsner" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Asiya Javayant" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2" />
|
|
|
|
<Chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mb-2" removable />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Styling</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<Chip label="Action" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2 custom-chip" />
|
|
|
|
<Chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="custom-chip mb-2" removable />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
}
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.p-chip.custom-chip {
|
|
|
|
background: var(--primary-color);
|
|
|
|
color: var(--primary-color-text);
|
|
|
|
}
|
|
|
|
</style>`
|
|
|
|
},
|
|
|
|
'browser-source': {
|
|
|
|
tabName: 'Browser Source',
|
|
|
|
imports: `<script src="https://unpkg.com/primevue@^3/chip/chip.min.js"><\\/script>`,
|
|
|
|
content: `<div id="app">
|
|
|
|
<h5>Basic</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<p-chip label="Action" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Comedy" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Mystery" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Thriller" class="mb-2" removable></p-chip>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Icon</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<p-chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Facebook" icon="pi pi-facebook" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Google" icon="pi pi-google" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Microsoft" icon="pi pi-microsoft" class="mb-2" removable></p-chip>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Image</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<p-chip label="Amy Elsner" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Asiya Javayant" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2"></p-chip>
|
|
|
|
<p-chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mb-2" removable></p-chip>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Styling</h5>
|
|
|
|
<div class="flex align-items-center flex-column sm:flex-row">
|
|
|
|
<p-chip label="Action" class="mr-2 mb-2 custom-chip"></p-chip>
|
|
|
|
<p-chip label="Apple" icon="pi pi-apple" class="mr-2 mb-2 custom-chip"></p-chip>
|
|
|
|
<p-chip label="Onyama Limba" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="mr-2 mb-2 custom-chip"></p-chip>
|
|
|
|
<p-chip label="Xuxue Feng" image="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" class="custom-chip mb-2" removable></p-chip>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
const { createApp } = Vue;
|
|
|
|
|
|
|
|
const App = {
|
|
|
|
components: {
|
|
|
|
"p-chip": primevue.chip
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
createApp(App).mount('#app');
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.p-chip.custom-chip {
|
|
|
|
background: var(--primary-color);
|
|
|
|
color: var(--primary-color-text);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|