Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,26 @@ The title of the tab will now be `my prefix - First tab - my suffix`.

The fragment that's added to the url when clicking the tab will only be based on the `name` of a tab, the `name-prefix` and `name-suffix` attributes will be ignored.

### Additional slots

You can add content using additional slots.

Available slots: `before-list`, `before-tabs`, `after-tabs`, `after-list`

```html
<div>
<tabs>
<template #after-tabs>My requests</template>
<tab name="Active">
First tab content
</tab>
<tab name="Passive">
Second tab content
</tab>
</tabs>
</div>
```

### Customizing fragments

When clicking on a tab it's name will be used as a fragment in the url. For example clicking on the `Second tab` will append `#second-tab` to the current url.
Expand Down
4 changes: 4 additions & 0 deletions src/components/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
:class="wrapperClass"
:id="id"
>
<slot name="before-list" />
<ul
role="tablist"
:class="navClass"
>
<slot name="before-tabs" />
<li
v-for="(tab, i) in state.tabs"
:key="i"
Expand All @@ -32,7 +34,9 @@
tabindex="0"
/>
</li>
<slot name="after-tabs" />
</ul>
<slot name="after-list" />
<div :class="panelsWrapperClass">
<slot />
</div>
Expand Down