🔥 了解我们新的项目 t0ggles - 您终极的项目管理工具! 🔥

芯片 Svelte 组件

芯片 (标签) Svelte 组件以小块的形式表示复杂的实体,例如联系人。它们可以包含照片、简短的标题字符串和简短的信息

芯片组件

包括以下组件

  • 芯片

芯片属性

名称类型默认值描述
颜色对象

包含 Tailwind CSS 颜色类的对象

colors.fillBgIos字符串'bg-black bg-opacity-10 dark:bg-white dark:bg-opacity-10'
colors.fillBgMaterial字符串'bg-md-light-secondary-container dark:bg-md-dark-secondary-container'
colors.fillTextIos字符串'text-current'
colors.fillTextMaterial字符串'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container'
colors.outlineBorderIos字符串'border-black border-opacity-20 dark:border-white dark:border-opacity-20'
colors.outlineBorderMaterial字符串'border-md-light-outline dark:border-md-dark-outline'
colors.outlineTextIos字符串'text-current'
colors.outlineTextMaterial字符串'text-md-light-on-surface dark:text-md-dark-on-surface'
删除按钮布尔值false

定义芯片是否具有额外的“删除”按钮

轮廓布尔值false

使芯片轮廓

onDelete函数(e)

事件将在芯片删除按钮单击时触发

onClick函数(e)

click 事件处理程序

芯片插槽

名称描述
媒体

芯片媒体区域的内容(例如图标)

示例

Chips.svelte
<script>
import {
Page,
Navbar,
NavbarBackLink,
Chip,
Block,
BlockTitle,
} from 'konsta/svelte';
</script>
<Page>
<Navbar title="Chips" />
<BlockTitle>Chips With Text</BlockTitle>
<Block strongIos outlineIos>
<Chip class="m-0.5">Example Chip</Chip>
<Chip class="m-0.5">Another Chip</Chip>
<Chip class="m-0.5">One More Chip</Chip>
<Chip class="m-0.5">Fourth Chip</Chip>
<Chip class="m-0.5">Last One</Chip>
</Block>
<BlockTitle>Outline Chips</BlockTitle>
<Block strongIos outlineIos>
<Chip outline class="m-0.5">Example Chip</Chip>
<Chip outline class="m-0.5">Another Chip</Chip>
<Chip outline class="m-0.5">One More Chip</Chip>
<Chip outline class="m-0.5">Fourth Chip</Chip>
<Chip outline class="m-0.5">Last One</Chip>
</Block>
<BlockTitle>Contact Chips</BlockTitle>
<Block strongIos outlineIos>
<Chip class="m-0.5">
<img
slot="media"
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
Jane Doe
</Chip>
<Chip class="m-0.5">
<img
slot="media"
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
John Doe
</Chip>
<Chip class="m-0.5">
<img
slot="media"
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
Adam Smith
</Chip>
</Block>
<BlockTitle>Deletable Chips / Tags</BlockTitle>
<Block strongIos outlineIos>
<Chip
class="m-0.5"
deleteButton
onDelete={() => console.log('Delete Chip')}
>
Example Chip
</Chip>
<Chip
class="m-0.5"
deleteButton
onDelete={() => console.log('Delete Chip')}
>
<img
slot="media"
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
Adam Smith
</Chip>
</Block>
<BlockTitle class=" bg-b bg-b">Color Chips</BlockTitle>
<Block strongIos outlineIos>
<Chip
class="m-0.5"
colors={{ fillBg: 'bg-red-500', fillText: 'text-white' }}
>
Red Chip
</Chip>
<Chip
class="m-0.5"
colors={{ fillBg: 'bg-green-500', fillText: 'text-white' }}
>
Green Chip
</Chip>
<Chip
class="m-0.5"
colors={{ fillBg: 'bg-blue-500', fillText: 'text-white' }}
>
Blue Chip
</Chip>
<Chip
class="m-0.5"
colors={{ fillBg: 'bg-yellow-500', fillText: 'text-white' }}
>
Yellow Chip
</Chip>
<Chip
class="m-0.5"
colors={{ fillBg: 'bg-pink-500', fillText: 'text-white' }}
>
Pink Chip
</Chip>
<Chip
class="m-0.5"
outline
colors={{ outlineBorder: 'border-red-500', outlineText: 'text-red-500' }}
>
Red Chip
</Chip>
<Chip
class="m-0.5"
outline
colors={{
outlineBorder: 'border-green-500',
outlineText: 'text-green-500',
}}
>
Green Chip
</Chip>
<Chip
class="m-0.5"
outline
colors={{
outlineBorder: 'border-blue-500',
outlineText: 'text-blue-500',
}}
>
Blue Chip
</Chip>
<Chip
class="m-0.5"
outline
colors={{
outlineBorder: 'border-yellow-500',
outlineText: 'text-yellow-500',
}}
>
Yellow Chip
</Chip>
<Chip
class="m-0.5"
outline
colors={{
outlineBorder: 'border-pink-500',
outlineText: 'text-pink-500',
}}
>
Pink Chip
</Chip>
</Block>
</Page>
代码许可证 MIT.
2022 © Konsta UI 由 nolimits4web.