Tab
Switch between related routes or views with explicit state.
Preview
Choose an example destination. The preview updates locally without leaving this page.
Example
<.tabs id="settings"><:tab label="Profile" patch={~p"/settings/profile"} active /></.tabs>
API contract
tabs/1
uses declared Phoenix attributes and slots. This table is generated from the compiled component metadata.
| Attribute | Type | Required | Default | Accepted values |
|---|---|---|---|---|
id |
:string |
Yes | — |
Any value matching the declared type |
label |
:string |
No | "Sections" |
Any value matching the declared type |
variant |
:atom |
No | :border |
[:box, :border, :lift] |
size |
:atom |
No | :md |
[:xs, :sm, :md, :lg, :xl] |
class |
:any |
No | nil |
Any value matching the declared type |
| Slot | Required | Slot attributes |
|---|---|---|
tab |
Yes | label: :string required, active: :boolean, disabled: :boolean, href: :string, navigate: :string, patch: :string |
States and behavior
Default and caller-supplied variants preserve semantic daisyUI colors and additive classes.
Keyboard and accessibility
Behavioral tests
These automated checks are applied to this component by the package and documentation test suites.
-
ExUnit
Tab navigation state
Keeps enabled tabs as native destinations and exposes active and disabled state through ARIA and styling.
test/vaylan_ui/components_test.exs -
Browser
Rendered interaction
Clicks an enabled example tab and verifies that the component documentation URL does not change.
examples/docs/assets/test/browser-smoke.mjs -
Docs
Preview behavior contract
Classified as navigation. Choose an example destination. The preview updates locally without leaving this page.
examples/docs/test/vaylan_ui_docs_web/controllers/page_controller_test.exs -
Docs
Stable public component page
Renders the component name, example, API contract, accepted values, and keyboard and accessibility guidance at its stable URL.
examples/docs/test/vaylan_ui_docs_web/controllers/page_controller_test.exs