Tab
<afp-tab>
A tab component to select and reveal a specific panel within a tab group.
Use the Tab Panel component to create tab panels associated with
<afp-tab>elements.
Examples #
Active #
Use the active attribute to indicate the currently active tab.
Actions #
You can add icons, badges, or other elements to the tab using the actions slot.
Disabled #
Use the disabled attribute to disable a tab.
Properties
Learn more about properties.
| Name | Description | Reflects |
|---|---|---|
panel
|
The name of the tab panel the tab will control.
The panel must be located in the same tab group.
Type
string
|
|
disabled
|
Set to true to draw the tab in a disabled state.
Type
boolean
Default
false |
|
active
|
Set to true to display this tab.
Type
boolean
Default
false |
|
Methods
Learn more about using methods.
| Name | Description | Arguments |
|---|---|---|
setFocus
|
Sets focus on the tab element.
This method programmatically sets focus on the associated tab element. You can optionally provide custom focus options
to control the behavior of the focus action (e.g., whether it should scroll into view).
|
options<FocusOptions>
— Optional settings to customize the behavior of the focus action (e.g., `preventScroll`).
|
Slots
Learn more about slots.
| Name | Description |
|---|---|
default
|
Slot for adding custom content inside the tab
|
actions
|
Slot for adding action elements inside the tab
|
CSS Parts
Learn more about CSS Parts.
| Name | Description | Selector |
|---|---|---|
base
|
The container for the tab when it is in the default state
|
::part(base)
|
base-active
|
The container for the tab when it is active
|
::part(base-active)
|
base-disabled
|
The container for the tab when it is disabled
|
::part(base-disabled)
|
content
|
The inner content of the tab
|
::part(content)
|
value
|
The value container inside the tab content
|
::part(value)
|
Importing
Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.
import '@afp-design-system/core/dist/components/tab/tab.js';