mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
chore(tabs): pass id to anchor link in Tab
This commit is contained in:
parent
a0b6b561af
commit
121768598c
2 changed files with 6 additions and 2 deletions
|
@ -51,7 +51,6 @@
|
|||
<li
|
||||
tabindex="-1"
|
||||
role="presentation"
|
||||
{id}
|
||||
class:bx--tabs__nav-item={true}
|
||||
class:bx--tabs__nav-item--disabled={disabled}
|
||||
class:bx--tabs__nav-item--selected={selected}
|
||||
|
@ -81,6 +80,7 @@
|
|||
tabindex={disabled ? '-1' : tabindex}
|
||||
aria-selected={selected}
|
||||
aria-disabled={disabled}
|
||||
{id}
|
||||
{href}
|
||||
class:bx--tabs__nav-link={true}>
|
||||
<slot>{label}</slot>
|
||||
|
|
|
@ -33,12 +33,16 @@
|
|||
const tabsById = derived(tabs, (_) =>
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {})
|
||||
);
|
||||
|
||||
const selectedTab = writable(undefined);
|
||||
const content = writable([]);
|
||||
const contentById = derived(content, (_) =>
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {})
|
||||
);
|
||||
const selectedContent = writable(undefined);
|
||||
|
||||
setContext("Tabs", {
|
||||
tabs,
|
||||
contentById,
|
||||
selectedTab,
|
||||
selectedContent,
|
||||
add: (data) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue