Add autoWidth prop to Tabs (#901)

* feat(tabs): support auto width tabs

Closes #899

* docs(tabs): add auto width example
This commit is contained in:
Eric Liu 2021-11-10 19:46:20 -08:00 committed by GitHub
commit ea6757d020
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 7 deletions

View file

@ -22,7 +22,7 @@
import { onMount, afterUpdate, getContext, tick } from "svelte";
const { selectedTab, add, update, change } = getContext("Tabs");
const { selectedTab, useAutoWidth, add, update, change } = getContext("Tabs");
add({ id, label, disabled });
@ -81,6 +81,7 @@
id="{id}"
href="{href}"
class:bx--tabs__nav-link="{true}"
style="{$useAutoWidth ? 'width: auto' : undefined}"
>
<slot>{label}</slot>
</a>