hd-tabs
on changePanes (hd-tab) of which one shows at a time, switched by tapping the tab bar, swiping across the pane or the arrow keys. To remember the choice per screen, bind selected to the widget’s state and keep each change: selected="{{ state.period }}" data-hd-on-change="setState('period', event.value)".
| Attribute | What it is |
|---|---|
selected | The name of the tab to show; empty or unknown shows the first. |
label | What the tabs choose between, for screen readers, e.g. “Period”. |
variant | The tab bar: a pill track, an underline, a segmented track, plain (the Navigation bar’s look: a soft wash behind the current tab, or behind its icon with layout="stacked"), glass (frosted with the theme’s blur), dots (the labels are read out), or none: no bar, the panes swipe.One of pill, underline, segmented, plain, glass, dots, none. Default pill. |
placement | Where the tab bar sits. On the left or right it is a rail the pane’s height, at least 48, 56 or 72 px wide by size (or --hd-tabs-rail-width); the pages come in from above or below.One of top, bottom, left, right. Default top. |
fill | Spreads the tabs along the bar: over its width at the top or bottom, over its height on a side. Left out, each tab is as big as it needs; spread out on a crowded bar, a tab narrower than 72 px shows its icon only.Default false. |
align | Where tabs that don’t fill the bar sit: at its start, centre or end (top, middle or bottom on a side).One of start, center, end. Default start. |
layout | The icon beside the name (inline) or over it (stacked), as an app’s tab bar.One of inline, stacked. Default inline. |
floating | Stands the bar off the box, centred and with a shadow, instead of part of it.Default false. |
transition | How a new page comes in after a tap: sliding (the default), fading or at once. Reduced motion fades and e-ink cuts whatever this says.One of slide, fade, cut. Default slide. |
start | The name of the tab shown while selected names none, and the one idle goes back to; left out, the first. |
idle | Goes back to the start tab after this many seconds without a touch (at least 5), saying so as change. For wall panels; not on e-ink. |
axis | Which way the panes turn: sideways (swipe across), or up and down like a smart display’s stack (swipe up for the next, down for the one before; the next pane comes up from below). Put the bar on a side (placement="right") or hide it for the look.One of horizontal, vertical. Default horizontal. |
loop | A swipe goes round the ends: past the last pane comes the first, before the first the last (the timer always does).Default false. |
show | What the tabs show of each pane: both its icon and label, only the label, or only the icon (a tab without an icon keeps its label; screen readers always hear the label).One of both, label, icon. Default both. |
size | How big the tabs (and the dots) are to tap: small, medium for a tablet, large for a wall panel across the room, or auto, medium on a touch screen and small with a mouse.One of small, medium, large, auto. Default small. |
swipe | Swiping across the pane goes to the next or previous tab (and never pages a wall panel).Default true. |
every | Turns to the next tab by itself every this many seconds (3 to 300), round to the first after the last. It pauses for 30 seconds after a touch, stops while the page is out of sight and on a screen that doesn’t animate (e-ink). With full motion a thin line (part="countdown") runs down to the next turn, hidden while it waits after a touch. Left out, the tabs only turn when someone does. |
<hd-tabs label="Period" selected="{{ state.period }}" data-hd-on-change="setState('period', event.value)"> <hd-tab name="today" label="Today"><p>Today</p></hd-tab> <hd-tab name="week" label="Week"><p>This week</p></hd-tab></hd-tabs>