Skip to content

Commit e0f6625

Browse files
authored
Basic usage example
For inexperienced developers like myself...
1 parent 2efc3d2 commit e0f6625

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

packages/tab/README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,41 @@ npm install --save-dev @smui/tab
1616

1717
# Basic Usage
1818

19-
todo...
20-
19+
Use if/else conditional constructs to display tab content, eg:
20+
21+
```javascript
22+
<script>
23+
import TabBar from '@smui/tab-bar';
24+
import Tab from '@smui/tab';
25+
import Paper, { Subtitle } from '@smui/paper';
26+
let active = 'Home';
27+
</script>
28+
<TabBar tabs={['Home', 'Merchandise', 'About Us']} let:tab bind:active>
29+
<!-- Note: the `tab` property is required! -->
30+
<Tab {tab} tabIndicator$transition="fade">
31+
<Label>{tab}</Label>
32+
</Tab>
33+
</TabBar>
34+
{#if active ==="Home"}
35+
<Paper class="paper-demo">
36+
<Title>Paper</Title>
37+
<Subtitle>This is a sheet of paper.</Subtitle>
38+
<Content>Home Content.</Content>
39+
</Paper>
40+
{:else if active ==="Merchandise"}
41+
<Paper class="paper-demo">
42+
<Title>Paper</Title>
43+
<Subtitle>This is a sheet of paper.</Subtitle>
44+
<Content>Merchandise content.</Content>
45+
</Paper>
46+
{:else if active ==="About Us"}
47+
<Paper class="paper-demo">
48+
<Title>Paper</Title>
49+
<Subtitle>This is a sheet of paper.</Subtitle>
50+
<Content>About Content.</Content>
51+
</Paper>
52+
{/if}
53+
```
2154
# Exports
2255

2356
todo...

0 commit comments

Comments
 (0)