チップス
チップ(タグ)は、連絡先のような複雑なエンティティを小さなブロックで表現します。写真、短いタイトル文字列、簡単な情報を含むことができます。
チップのレイアウト
基本的なチップのHTMLレイアウトを見てみましょう。
<div class="chip">
<div class="chip-media">
<img src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg" />
</div>
<div class="chip-label">Jane Doe</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip chip-outline">
<div class="chip-label">Outline Chip</div>
</div>
構造
<div class="chip">
- チップのコンテナ<div class="chip-media">
- チップの「メディア」要素で、画像やアバター、アイコンなどを入れることができます。オプション オプション<div class="chip-label">
- チップのテキストラベル<a class="chip-delete">
- チップの削除アイコンです。Optionalchip-outline
- チップをアウトライン化するために、チップ要素に追加できるクラスです。
CSS Variables
Below is the list of related CSS variables (CSS custom properties).
:root {
--f7-chip-font-size: 14px;
--f7-chip-font-weight: normal;
--f7-chip-media-font-size: 16px;
--f7-chip-bg-color: rgba(0, 0, 0, 0.12);
--f7-chip-outline-border-color: rgba(0, 0, 0, 0.12);
--f7-chip-delete-button-color: #000;
}
:root .theme-dark,
:root.theme-dark {
--f7-chip-delete-button-color: #fff;
--f7-chip-bg-color: #333;
--f7-chip-outline-border-color: rgba(255, 255, 255, 0.12);
}
.ios {
--f7-chip-height: 28px;
--f7-chip-padding-horizontal: 10px;
--f7-chip-text-color: #000;
}
.ios .theme-dark,
.ios.theme-dark {
--f7-chip-text-color: #fff;
}
.md {
--f7-chip-height: 32px;
--f7-chip-padding-horizontal: 12px;
--f7-chip-text-color: rgba(0, 0, 0, 0.87);
}
.md .theme-dark,
.md.theme-dark {
--f7-chip-text-color: rgba(255, 255, 255, 0.87);
}
.aurora {
--f7-chip-height: 32px;
--f7-chip-padding-horizontal: 12px;
--f7-chip-text-color: #000;
}
.aurora .theme-dark,
.aurora.theme-dark {
--f7-chip-text-color: #fff;
}
Examples
<template>
<div class="page">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="title">Chips</div>
</div>
</div>
<div class="page-content">
<div class="block-title">Chips With Text</div>
<div class="block block-strong">
<div class="chip">
<div class="chip-label">Example Chip</div>
</div>
<div class="chip">
<div class="chip-label">Another Chip</div>
</div>
<div class="chip">
<div class="chip-label">One More Chip</div>
</div>
<div class="chip">
<div class="chip-label">Fourth Chip</div>
</div>
<div class="chip">
<div class="chip-label">Last One</div>
</div>
</div>
<div class="block-title">Outline Chips</div>
<div class="block block-strong">
<div class="chip chip-outline">
<div class="chip-label">Example Chip</div>
</div>
<div class="chip chip-outline">
<div class="chip-label">Another Chip</div>
</div>
<div class="chip chip-outline">
<div class="chip-label">One More Chip</div>
</div>
<div class="chip chip-outline">
<div class="chip-label">Fourth Chip</div>
</div>
<div class="chip chip-outline">
<div class="chip-label">Last One</div>
</div>
</div>
<div class="block-title">Icon Chips</div>
<div class="block block-strong">
<div class="chip">
<div class="chip-media bg-color-blue">
<i class="icon f7-icons if-not-md">plus_circle</i>
<i class="icon material-icons md-only">add_circle</i>
</div>
<div class="chip-label">Add Contact</div>
</div>
<div class="chip">
<div class="chip-media bg-color-green">
<i class="icon f7-icons if-not-md">compass</i>
<i class="icon material-icons md-only">location_on</i>
</div>
<div class="chip-label">London</div>
</div>
<div class="chip">
<div class="chip-media bg-color-red">
<i class="icon f7-icons if-not-md">person</i>
<i class="icon material-icons md-only">person</i>
</div>
<div class="chip-label">John Doe</div>
</div>
</div>
<div class="block-title">Contact Chips</div>
<div class="block block-strong">
<div class="chip">
<div class="chip-media"><img src="https://cdn.framework7.io/placeholder/people-64x64-9.jpg" /></div>
<div class="chip-label">Jane Doe</div>
</div>
<div class="chip">
<div class="chip-media"><img src="https://cdn.framework7.io/placeholder/people-64x64-9.jpg" /></div>
<div class="chip-label">John Doe</div>
</div>
<div class="chip">
<div class="chip-media"><img src="https://cdn.framework7.io/placeholder/people-64x64-9.jpg" /></div>
<div class="chip-label">Adam Smith</div>
</div>
<div class="chip">
<div class="chip-media bg-color-pink">J</div>
<div class="chip-label">Jennifer</div>
</div>
<div class="chip">
<div class="chip-media bg-color-yellow text-color-black">C</div>
<div class="chip-label">Chris</div>
</div>
<div class="chip">
<div class="chip-media bg-color-red">K</div>
<div class="chip-label">Kate</div>
</div>
</div>
<div class="block-title">Deletable Chips / Tags</div>
<div class="block block-strong">
<div class="chip">
<div class="chip-label">Example Chip</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip">
<div class="chip-media bg-color-orange text-color-black">C</div>
<div class="chip-label">Chris</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip">
<div class="chip-media"><img src="https://cdn.framework7.io/placeholder/people-64x64-9.jpg" /></div>
<div class="chip-label">Jane Doe</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip">
<div class="chip-label">One More Chip</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip">
<div class="chip-media bg-color-pink">J</div>
<div class="chip-label">Jennifer</div>
<a href="#" class="chip-delete"></a>
</div>
<div class="chip">
<div class="chip-media"><img src="https://cdn.framework7.io/placeholder/people-64x64-9.jpg" /></div>
<div class="chip-label">Adam Smith</div>
<a href="#" class="chip-delete"></a>
</div>
</div>
<div class="block-title">Color Chips</div>
<div class="block block-strong">
<div class="chip color-red">
<div class="chip-label">Red Chip</div>
</div>
<div class="chip color-green">
<div class="chip-label">Green Chip</div>
</div>
<div class="chip color-blue">
<div class="chip-label">Blue Chip</div>
</div>
<div class="chip color-orange">
<div class="chip-label">Orange Chip</div>
</div>
<div class="chip color-pink">
<div class="chip-label">Pink Chip</div>
</div>
<div class="chip chip-outline color-red">
<div class="chip-label">Red Chip</div>
</div>
<div class="chip chip-outline color-green">
<div class="chip-label">Green Chip</div>
</div>
<div class="chip chip-outline color-blue">
<div class="chip-label">Blue Chip</div>
</div>
<div class="chip chip-outline color-orange">
<div class="chip-label">Orange Chip</div>
</div>
<div class="chip chip-outline color-pink">
<div class="chip-label">Pink Chip</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default (props, { $, $f7, $on }) => {
$on('pageInit', () => {
$('.chip-delete').on('click', function (e) {
e.preventDefault();
var chip = $(this).parents('.chip');
$f7.dialog.confirm('Do you want to delete this tiny demo Chip?', function () {
chip.remove();
});
});
})
return $render;
}
</script>