Handle dynamically adding items in list components: Radio Group, Tabs, Listbox, Menu

Fixes #29

Upstream Headless UI handles this for Radio Group but not for the others. I didn't see any reason why not to implement this for the other ones too.
This commit is contained in:
Ryan Gossiaux
2021-12-31 11:46:00 -10:00
parent b5b6854d2d
commit e16e27f04e
10 changed files with 263 additions and 14 deletions

View File

@@ -11,6 +11,8 @@
export let use: HTMLActionArray = [];
let api = useTabsContext("TabList");
let listRef = $api.listRef;
$: propsWeControl = {
role: "tablist",
"aria-orientation": $api.orientation,
@@ -23,6 +25,7 @@
{...{ ...$$restProps, ...propsWeControl }}
{as}
{slotProps}
bind:el={$listRef}
use={[...use, forwardEvents]}
name={"TabList"}
>