Skip to content

Commit 6eb62b4

Browse files
committed
docs: fix incomplete tab panel snippet in cookbook
Complete the truncated effect to toggle panel visibility via context $active, matching the working tabs example. Drop unused register field from TabsAPI so the snippet type-checks. Closes #12
1 parent a7a3d2f commit 6eb62b4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apps/docs/src/content/docs/cookbook.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ When components form a logical group (Tabs/Tab, Accordion/Panel), the parent pro
149149
```typescript
150150
import { createContext } from "nanotags/context";
151151

152-
type TabsAPI = { register: (el: Element) => void; $active: WritableAtom<string> };
152+
type TabsAPI = { $active: WritableAtom<string> };
153153
const tabsContext = createContext<TabsAPI>("tabs");
154154

155155
const XTabs = define("x-tabs").setup((ctx) => {
@@ -165,7 +165,7 @@ define("x-tab-panel")
165165
.withContexts({ tabs: tabsContext })
166166
.setup((ctx) => {
167167
ctx.effect(ctx.contexts.tabs.$active, (active) => {
168-
ctx.host.setAttribute('aria-)
168+
ctx.host.hidden = active !== ctx.props.$value.get();
169169
})
170170
});
171171
```

0 commit comments

Comments
 (0)