Design System

Tabs reference ​

The props, events, slots, rendered DOM and forwarded attributes of CTabs and CTab. For what each is for, see Overview. For how to apply them, see Usage.

Both are imported from @proxy-frontend/components, alongside the CTabsItem and CTabsProps types.

CTabs props ​

NameTypeRequiredDefaultMeaning
itemsCTabsItem<T>[]YesnoneOne tab button and one panel per entry, in array order
indicatorbooleanNotruePicks the class on the active bar section
valueTYesnoneTwo-way. Holds the id of the active item

T is a generic parameter constrained to string, defaulting to string. value is declared with defineModel<T>("value", { required: true }), so the template has to supply it.

CTabsItem ​

FieldTypeRequiredUsed for
idTYesThe tab value, the panel value, and the panel slot name
labelstringNoThe fallback content of the shared tab slot, and nothing else

CTabs events ​

NameTemplatePayloadTiming
update:value@update:valueTEmitted by the model, proxied from the library
tabClick@tab-clickT, the id of the clicked itemAfter the model has changed
tabMouseDown@tab-mouse-downT, the id of the itemOn mousedown, bound with .stop

The library merges its own click handler ahead of the forwarded one, which is why the model has already moved by the time tabClick runs. The .stop modifier means a mousedown on a tab does not reach an ancestor.

CTabs slots ​

NameRenderedScopeFallback content
tab-<id>Per item, checked first{ active }None
tabPer item with no tab-<id> slot{ active, item }item.label
<id>Per item panel, checked firstNoneNone
panelPer item panel with no <id> slot{ item }None
defaultNot rendered. The template has no unnamed slot

active arrives as undefined. The library renders a tab body with no scope properties unless the tab is asked to render as a child, and CTabs does not ask.

CTab props ​

NameTypeRequiredDefaultMeaning
isSelectedbooleanYesnoneWrites data-is-selected, and adds border-line-selected! to the chip
labelstringYesnoneThe value of the label, and the seed of the field while renaming
iconstringNoundefinedRenders an i with the resolved icon classes and mr-2
isEditablebooleanNofalseTwo-way. Writes data-is-editable, and swaps the label for a field

isSelected does not change the background or the foreground of either inner button.

CTab events ​

NameTemplatePayloadTiming
update:isEditable@update:is-editablebooleanEmitted by the model
select@selectMouseEventOn click of the label button, and on any mousedown whose button is not the left one
rename@renamestring, the new nameOn blur or Enter, after a 10ms debounce, and only when the value changed
close@closeNoneOn click of the close button

CTab slots ​

NameRenderedScopePosition
prefixWhen the slot is suppliedNoneBetween the icon and the label, inside a wrapper with mr-1
defaultNot rendered. The template has no unnamed slot

Vocabulary ​

AxisCTabsCTab
sizeNot acceptedNot accepted
severityNot acceptedNot accepted
variantNot acceptedNot accepted
disabledNot acceptedNot accepted

Neither imports the shared unions in components. The inner buttons of a CTab are fixed at severity="contrast" size="small" outlined and the default severity, and the caller's classes then set the surfaces, leaving the preset's text-fg-muted as the label colour.

CTabs DOM and ARIA ​

DepthElementAttributesClasses
1divdata-pc-name="tabs", data-pc-section="root", plus the forwarded attributesflex flex-col h-full min-h-0 flex flex-col
2divdata-pc-name="tablist", data-pc-section="root"relative flex
3divdata-pc-section="content"overflow-x-auto overflow-y-hidden scroll-smooth overscroll-x-contain overscroll-y-auto [&::-webkit-scrollbar]:hidden grow bg-surface-raised
4divdata-pc-section="tablist", role="tablist", aria-orientation="horizontal"relative flex border-b-4 border-surface-page
5buttonrole="tab", type="button", id, aria-selected, aria-controls, tabindex, data-p-active, data-p-disabled="false"The preset tab classes
5spandata-pc-section="activebar", role="presentation", aria-hidden="true"z-raised block absolute h-1 -bottom-1 bg-fill-secondary, or hidden
2divdata-pc-name="tabpanels", data-pc-section="root", role="presentation"flex-1 min-h-0 p-0!, then the preset bg-surface-raised text-fg-strong outline-0 and a padding of 15.75px with 12.25px at the top
3divdata-pc-name="tabpanel", role="tabpanel", id, aria-labelledby, tabindex="0", data-p-activesize-full

The indicator carries an inline width and left in pixels, written from the active tab's outer width and offset. Each panel is rendered and the inactive ones are hidden with display: none, because no lazy flag is passed. The previous and next scroll buttons in the preset need a scrollable flag that is never passed, so they are absent.

CTabs writes no ARIA of its own. The roles, the selection state, the roving tabindex, the generated identifiers and the arrow, Home, End, Enter and Space handling come from the library. An aria-label forwarded from a call site lands at depth 1 rather than on the element at depth 4, so it does not name the tab list.

CTab DOM and ARIA ​

DepthElementAttributesClasses
1divdata-is-selected, data-is-editable, a dblclick handler, plus every inherited attribute and listenerNone
2spandata-pc-name="buttongroup", role="group"border-line-selected! while selected, then border border-line-subtle rounded flex items-stretch, then the preset group classes
3buttondata-pc-name="button", type="button"px-2! bg-surface-page! border-line-subtle ring-0! border-none flex-1, then the preset small contrast outlined classes, whose text-fg-muted is the only text colour on the element
4iaria-hidden="true"The resolved icon classes, plus mr-2. Rendered when icon is set
4divNonemr-1 inline-flex items-center shrink-0 leading-none. Rendered when prefix is filled
4divsize="small", which is undeclared and renders as a literal attributetruncate
5spanNonepx-1 whitespace-nowrap, holding the label while the chip is not being renamed
5divNonerelative, wrapping the field while renaming
6spanNoneinvisible px-1 whitespace-nowrap, sizing the wrapper from the draft value
6inputname="label", autocomplete="off"absolute top-0 left-0 w-full h-full px-1 text-caption rounded bg-surface-page overflow-hidden text-ellipsis, focused and selected when it opens
3buttondata-pc-name="button", type="button", aria-label="Close"w-8 self-stretch transition bg-surface-page hover:bg-surface-page! text-fg-subtle hover:text-fg-secondary border-none rounded-e, then the preset default classes
4spandata-pc-section="icon"fas fa-xmark text-base leading-4 mx-0
4spandata-pc-section="label"duration-200 font-medium truncate invisible w-0, holding a single space

CTab supplies one ARIA value of its own, the close button's aria-label, taken from the packages.components.cTab.close message. The icon carries aria-hidden from CIcon, and the button group carries role="group" from the library. The root has no role and no aria-selected, so a strip of chips is not a tab list and carries no keyboard path to rename.

Forwarded attributes ​

ShapeCTabsCTab
data-*Reaches the container at depth 1Reaches the root
aria-*Reaches the container at depth 1Reaches the root
on followed by a capitalReaches the container at depth 1Reaches the root
id, name, formReaches the container at depth 1Reaches the root
class, styleRemoved, with nothing reportedReaches the root
title, tabindex, roleRemoved, with nothing reportedReaches the root

CTabs sets inheritAttrs: false and filters through useForwardedAttrs, whose pattern is /^(data-|aria-|on[A-Z])|^(id|name|form)$/. A forwarded id also seeds the generated tab and panel identifiers.

CTab sets only a name, so inheritAttrs keeps its default of true and the root takes whatever the call site writes. The two behave in opposite ways, and the three chip call sites depend on the forwarding.

Library sections ​

SectionPreset classClass after the component applies its own
tabs rootflex flex-colThe attribute class flex flex-col h-full min-h-0 followed by the preset class
tablist contentoverflow-x-auto … grow bg-surface-raisedUnchanged
tablist tabListrelative flex border-solid border-b border-line-defaultReplaced by relative flex border-b-4 border-surface-page
tablist activeBarz-10 block absolute bg-fill-primary-hover, 1px tall and pulled 1px below the rowReplaced by the indicator class, or by hidden
tablist prevButton, nextButtonDefined in the presetNot rendered
tabpanels rootbg-surface-raised text-fg-strong outline-0, padded 15.75px with 12.25px at the topThe attribute class flex-1 min-h-0 p-0! followed by the preset class

The preset also defines a dimmed disabled tab, which no route reaches because CTabsItem carries no disabled field.

A class written as a pass-through section replaces the preset value, because the merge spreads one object over the other. A class written as an attribute is concatenated ahead of the preset class instead, which is why the tabs root and the panels area carry both.

Measurements ​

Taken at the 14 pixel interface default, against --spacing: 4px and a radius of 6px.

ValueWhereSource
56pxHeight of the tab row53px button, less 1px pull-back, plus the 4px band
53pxHeight of a tab buttonpy-4 either side of a 20px line box, plus a 1px bottom border
15.75pxPadding either side of a tab labelThe preset padding of 1.125rem against a 14px root
31.5pxWidth of a tab with no label and no slotThe two paddings alone
6pxTop corners of a tab buttonrounded-t-md, aliased onto the one radius
4pxBand under the tab rowborder-b-4 border-surface-page
4pxHeight of the indicatorh-1, offset -bottom-1, on the raised layer
0Padding inside the panels areap-0! overriding the preset padding
200msTransition on a tab buttontransition-all duration-200 in the preset
32pxHeight of a chipA 30px button inside a 1px border
40pxWidth of the chip close buttonThe preset w-10, which the stylesheet orders after w-8
12pxChip label and icontext-sm, which resolves to the caption role
8pxGap after a chip iconmr-2
4pxGap after a chip prefixmr-1

The one radius is in space, the raised layer in depth, and the durations the system does define in motion.

Contrast ​

Computed from the rendered sRGB of each token pair.

PairDarkLight
fg-secondary on surface-raised, the active tab label6.214.58
fg-default on surface-raised, an inactive tab label7.488.90
fg-strong on surface-raised, panel text10.3513.40
line-secondary on surface-raised, the active underline6.214.58
fill-secondary on surface-page, the indicator6.472.14
fg-muted on surface-page, a chip label5.585.56
fg-subtle on surface-page, the chip close glyph6.586.91
line-selected on surface-page, a selected chip border7.475.51
line-subtle on surface-page, a resting chip border1.661.67

fill-secondary is a single value with no light and dark pair, which is why the indicator drops to 2.14 in light. It is one of three cues, beside the label colour and the underline, rather than the only one.

Call sites ​

ComponentFeatureWhat it exercises
CTabsPluginsItems with no label, both tab-<id> slots, and both events
CTabsPlugin store detailTranslated labels, panel slots guarded against the model
CTabsAutomate session settingsFour labelled items, a sizing wrapper, tabMouseDown alone
CTabReplay tab stripis-editable, a prefix slot, a forwarded data- attribute and a forwarded context menu listener
CTabAutomate session tabAn icon, and a forwarded data- attribute
CTabAutomate entry tabThe plainest chip, with no icon and no prefix

Nothing in Caido passes indicator, uses the shared tab slot, or uses the shared panel slot.