Floating Bar
在录制就绪、进行中或处理中时悬浮于所有应用之上的胶囊条,带有关闭按钮。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 暂不可用
用法
<div class="demo-stack" style="max-width: 420px; width: 100%">
@if (visible()) {
<div style="height: 3rem">
<sone-floating-bar [state]="state()" (closed)="visible.set(false)">
<sone-status-orb [state]="orb()" />
<span>{{ state() === 'live' ? 'Recording · 02:14' : state() === 'processing' ? 'Writing the note…' : 'Ready · ⌘⇧R' }}</span>
</sone-floating-bar>
</div>
} @else {
<button soneBtn variant="outline" type="button" (click)="visible.set(true)">Show the bar</button>
}
<div class="demo-row">
@for (s of states; track s) {
<button soneBtn size="sm" [variant]="state() === s ? 'default' : 'outline'" type="button" (click)="state.set(s)">{{ s }}</button>
}
</div>
</div>导入
import {
SoneFloatingBarComponent,
} from "@surface-one/angular/floating-bar";API 参考
SoneFloatingBarComponent组件
| 名称 | 类型 | 默认值 |
|---|---|---|
state | FloatingBarState | "idle" |
closeLabel | — | $localize`:Button that hides the floating recording bar:Hide` |
closableShow the trailing close button. | boolean | true |
dragRegionAttrAn attribute that marks the bar's chrome as the window's drag handle — Tauri's `data-tauri-drag-region`. Set on the bar's own background element, so projected content needs none of its own. `null` = no attribute. | string | null | null |
dragRegionValueThe attribute's value. `deep` (default): Tauri 2.11 drags from anywhere inside the bar except buttons, links, inputs and labels; `""`: the background only. | string | "deep" |
| 名称 | 类型 |
|---|---|
closed | void |