Wrap a fixed tab's long label to a second line

Plan step 46, M3 § Tabs: "Labels: single row by default; may wrap to a
max second line if needed with truncation, or use scrollable tabs to
give longer titles more room." In fixed tabs (<x-tabs>, <x-section-nav>
up to four sections) the label's text, now its own data-md-tab-text in
both views, wraps and truncates at two lines. The tab's 48px (64px
stacked) is a minimum, the bar stretches its tabs to one height, and the
content stretches with them, so the indicator stays on the divider.
Scrollable tabs keep one row. SealShare's "Two-Factor Auth" and
"Appearance" showed an ellipsis at 600px.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andreas Reinhold / reini
2026-09-15 16:10:13 +02:00
co-authored by Claude Opus 5
parent 0a028b158f
commit 5b05e52e1c
6 changed files with 152 additions and 20 deletions
+8 -4
View File
@@ -12,12 +12,16 @@
the label, in primary) or `secondary` (under the whole tab, for tabs inside a section);
`stacked` puts a primary tab's icon over its label (64px); `scrollable` lets tabs keep their
own width and scroll sideways instead of sharing the width equally, offset 52dp from the
leading edge so it reads as scrollable (N-10, resources/css/components/tabs.css).
leading edge so it reads as scrollable (N-10, resources/css/components/tabs.css). A fixed
tab's label too long for its share wraps to a second line and truncates there, the whole bar
growing to hold it; a scrollable tab keeps its label on one line (M3: "may wrap to a max
second line if needed with truncation, or use scrollable tabs to give longer titles more
room").
The root renders `data-md-tabs`; the bar is `data-md-tabs-bar` with `data-md-variant`,
`data-md-stacked` and `data-md-scrollable`, holding `data-md-tab` buttons (each
`data-md-tab-content`, `data-md-tab-label` and `data-md-tab-indicator`). Imports icon.css and
badge.css for what the view renders. --}}
`data-md-tab-content`, `data-md-tab-label` around the label's `data-md-tab-text` and its badge,
and `data-md-tab-indicator`). Imports icon.css and badge.css for what the view renders. --}}
@props([
'tabs' => [],
@@ -84,7 +88,7 @@
<x-livewire-material::icon :name="$tab['icon']" />
@endisset
<span data-md-tab-label>
{{ $tab['label'] }}
<span data-md-tab-text>{{ $tab['label'] }}</span>
@if (filled($tab['badge'] ?? null))
<x-livewire-material::badge :value="$tab['badge']" />
@endif