Skip to content

Tabs System

When to use

Use Tabs for one-of-many panel selection where active state is a value, not a boolean.

Packages

PackageRole
@affino/tabs-coreHeadless tabs selection controller (value state).
@affino/tabs-vueVue composable wrapper (useTabsController).
@affino/tabs-laravelLaravel hydration contract for tabs roots/triggers/panels.
@affino/laravel-adapterRecommended Laravel bootstrap entry point.

Installation

bash
pnpm add @affino/tabs-core @affino/tabs-vue @affino/tabs-laravel @affino/laravel-adapter

Core API

ts
import { TabsCore } from "@affino/tabs-core"

const tabs = new TabsCore("overview")
tabs.select("settings")
tabs.clear()

See full API at /core/tabs-core.

Vue usage

ts
import { useTabsController } from "@affino/tabs-vue"

const tabs = useTabsController("overview")

Laravel usage

ts
import { bootstrapAffinoLaravelAdapters } from "@affino/laravel-adapter"

bootstrapAffinoLaravelAdapters()

Manual control

Tabs supports affino-tabs:manual with select and clear actions.

ts
document.dispatchEvent(
  new CustomEvent("affino-tabs:manual", {
    detail: { id: "profile-tabs", action: "select", value: "security" },
  }),
)

Troubleshooting

  • Selection not updating: verify tab values match exactly.
  • No-op select: check current value is not already selected.
  • Laravel command ignored: ensure root id matches manual event id.

MIT Licensed