Tab Bar

移动端风格的底部导航:带图标和当前标签文字的链接或按钮,可为悬浮胶囊或通栏,并避开主屏幕指示条。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

Active tab: home

导入

ts
import {
  SoneTabBarComponent,
} from "@surface-one/angular/tab-bar";

API 参考

SoneTabBarComponent组件

`<sone-tab-bar>` — mobile-style bottom navigation for the web (the twin of the React Native `SoneTabBar`): a `nav` of `items`, each a link (`href`, `aria-current="page"` while active) or a button (`aria-current="true"`), with an icon and the active tab's label (`labels="always"` shows every label; a hidden one still names the tab). The active tab is `[(value)]`. `floating` (the default) is a centred pill that sticks to the bottom of the scrolling page; without it a full-width bar with a top hairline. Both clear the home indicator (`env(safe-area-inset-bottom)`).

选择器
sone-tab-bar
输入
名称类型 默认值
items必填readonly TabBarItem[]—
value双向

The active tab's value — `[(value)]`.

string | nullnull
ariaLabel

Names the navigation landmark.

—$localize`:A bottom tab bar's navigation:Tab bar`
labels

`active` shows the active tab's label only; `always` every label.

TabBarLabels"active"
floating

A centred pill (the default); `false` is a full-width bar.

booleantrue