Card Svelte コンポーネント
カードは、リストビューと並んで、情報を格納し整理するための優れた方法です。カードには、例えば、写真、テキスト、単一の主題に関するリンクなど、一意に関連するデータが含まれています。カードは通常、より複雑で詳細な情報へのエントリポイントです。
Card Svelte コンポーネントは、カードコンポーネントを表します。
カードコンポーネント
次のコンポーネントが含まれています
Card
CardHeader
CardContent
CardFooter
カードプロパティ
Prop | Type | Default | Description |
---|---|---|---|
<Card> のプロパティ | |||
title | string | カードヘッダーの内容 | |
content | string | カードの内容 | |
footer | string | カードフッターの内容 | |
padding | boolean | true | カードコンテンツに追加の内部パディングを追加します |
outline | boolean | false | カードをアウトライン化(ボーダー付き)します |
outlineIos | boolean | false | iOSテーマでカードをアウトライン化します |
outlineMd | boolean | false | MDテーマでカードをアウトライン化します |
raised | boolean | false | カードを隆起させ、影を付けます |
headerDivider | boolean | false | カードヘッダーに区切り線(ボーダー)を追加します |
footerDivider | boolean | false | カードフッターに区切り線(ボーダー)を追加します |
expandable | boolean | false | 展開可能なカードを有効にします |
expandableAnimateWidth | boolean | false | カードコンテンツの幅もアニメーション可能でレスポンシブにしますが、パフォーマンスに影響を与える可能性があります |
expandableOpened | boolean | false | 展開可能なカードが開いているかどうかを示すブール値プロパティ |
animate | boolean | true | 展開可能なカードを開くときにアニメーションを使用するかどうかを指定します |
hideNavbarOnOpen | boolean | 展開可能なカードが開いたときにナビバーを非表示にします。デフォルトでは、同じアプリのカードパラメータを継承します。 | |
hideToolbarOnOpen | boolean | 展開可能なカードが開いたときにツールバーを非表示にします。デフォルトでは、同じアプリのカードパラメータを継承します。 | |
swipeToClose | boolean | スワイプで展開可能なカードを閉じることができます。デフォルトでは、同じアプリのカードパラメータを継承します。 | |
backdrop | boolean | 展開可能なカードの背景レイヤーを有効にします。デフォルトでは、同じアプリのカードパラメータを継承します。 | |
backdropEl | string | カスタムの展開可能なカードの背景要素を指定できます。これは、背景要素のCSSセレクターである必要があります。例:.card-backdrop.custom-backdrop | |
closeByBackdropClick | boolean | 有効にすると、背景をクリックすると展開可能なカードが閉じます。デフォルトでは、同じアプリのカードパラメータを継承します。 | |
<CardContent> のプロパティ | |||
padding | boolean | true | 追加の内部パディングを追加します |
カードイベント
イベント | Description |
---|---|
<Card> イベント | |
cardBeforeOpen | 展開可能なカードが開くアニメーションを開始する直前にトリガーされるイベント。event.detail.prevent には、呼び出すとカードが開くのを防ぐ関数が含まれています |
cardOpen | 展開可能なカードが開くアニメーションを開始するときにトリガーされるイベント |
cardOpened | 展開可能なカードが開くアニメーションを完了した後にトリガーされるイベント |
cardClose | 展開可能なカードが閉じるアニメーションを開始するときにトリガーされるイベント |
cardClosed | 展開可能なカードが閉じるアニメーションを完了した後にトリガーされるイベント |
カードスロット
<Card>
コンポーネントには、次のスロットがあります
default
- 要素はカードコンテンツ要素の子として挿入されますcontent
-default
と同じheader
- 要素はカードヘッダー要素の子として挿入されますfooter
- 要素はカードフッター要素の子として挿入されます
<Card>
<span slot="header">Header</span>
<span slot="content">Content</span>
<span slot="footer">Footer</span>
</Card>
レンダリング先
<div class="card">
<div class="card-header">
<span>Header</span>
</div>
<div class="card-content">
<span>Content</span>
</div>
<div class="card-footer">
<span>Footer</span>
</div>
</div>
例
cards.svelte
<script>
import {
Navbar,
Page,
Block,
BlockTitle,
Card,
CardHeader,
CardContent,
CardFooter,
List,
ListItem,
Link,
} from 'framework7-svelte';
</script>
<!-- svelte-ignore a11y-missing-attribute -->
<Page>
<Navbar title="Cards" />
<Block>
<p>
Cards are a great way to contain and organize your information, especially when combined with
List Views. Cards can contain unique related data, like for example photos, text or links
about a particular subject. Cards are typically an entry point to more complex and detailed
information.
</p>
</Block>
<BlockTitle>Simple Cards</BlockTitle>
<Card
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
/>
<Card
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
/>
<Card
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
/>
<BlockTitle>Outline Cards</BlockTitle>
<Card
outline
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
/>
<Card
outline
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
/>
<Card
outline
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
/>
<BlockTitle>Outline With Dividers</BlockTitle>
<Card
outline
headerDivider
footerDivider
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
/>
<BlockTitle>Raised Cards</BlockTitle>
<Card
raised
content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element."
/>
<Card
raised
title="Card header"
content="Card with header and footer. Card headers are used to display card titles and footers for additional information or just for custom actions."
footer="Card footer"
/>
<Card
raised
content="Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet. Mauris aliquet magna justo. "
/>
<BlockTitle>Styled Cards</BlockTitle>
<Card outlineMd class="demo-card-header-pic">
<CardHeader
valign="bottom"
style="background-image: url(https://cdn.framework7.io/placeholder/nature-1000x600-3.jpg)"
>Journey To Mountains</CardHeader
>
<CardContent>
<p class="date">Posted on January 21, 2015</p>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non felis.
Phasellus quis nibh hendrerit...
</p>
</CardContent>
<CardFooter>
<Link>Like</Link>
<Link>Read more</Link>
</CardFooter>
</Card>
<Card class="demo-card-header-pic">
<CardHeader
valign="bottom"
style="background-image: url(https://cdn.framework7.io/placeholder/people-1000x600-6.jpg)"
>Journey To Mountains</CardHeader
>
<CardContent>
<p class="date">Posted on January 21, 2015</p>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies efficitur vitae non felis.
Phasellus quis nibh hendrerit...
</p>
</CardContent>
<CardFooter>
<Link>Like</Link>
<Link>Read more</Link>
</CardFooter>
</Card>
<BlockTitle>Cards With List View</BlockTitle>
<Card>
<CardContent padding={false}>
<List>
<ListItem link="#">Link 1</ListItem>
<ListItem link="#">Link 2</ListItem>
<ListItem link="#">Link 3</ListItem>
<ListItem link="#">Link 4</ListItem>
<ListItem link="#">Link 5</ListItem>
</List>
</CardContent>
</Card>
<Card title="New Releases:">
<CardContent padding={false}>
<List mediaList>
<ListItem title="Yellow Submarine" subtitle="Beatles">
<img
slot="media"
src="https://cdn.framework7.io/placeholder/fashion-88x88-4.jpg"
width="44"
/>
</ListItem>
<ListItem title="Don't Stop Me Now" subtitle="Queen">
<img
slot="media"
src="https://cdn.framework7.io/placeholder/fashion-88x88-5.jpg"
width="44"
/>
</ListItem>
<ListItem title="Billie Jean" subtitle="Michael Jackson">
<img
slot="media"
src="https://cdn.framework7.io/placeholder/fashion-88x88-6.jpg"
width="44"
/>
</ListItem>
</List>
</CardContent>
<CardFooter>
<span>January 20, 2015</span>
<span>5 comments</span>
</CardFooter>
</Card>
</Page>