Preview Updated 2026-05-10

Title bar

Desktop app window header. macOS-style traffic lights with centered title; Windows / Linux-style min/max/close buttons with left-aligned title.

Basic usage

When platform="macos", three dots on the left (close / minimize / maximize) with a centered title. When platform="windows" / 'linux', three buttons on the right with a left-aligned title. The header has -webkit-app-region: drag by default, so a Tauri / Electron host can drag the window from there.

背景
orders.parquetprotoforge
macOS · centered title
orders.parquetprotoforge
Windows · min / max / close
<script setup lang="ts">
import { CfTitleBar } from '@chufix-design/vue';
</script>

<template>
  <div style="display: flex; flex-direction: column; gap: 12px;">
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="macos" title="orders.parquet" subtitle="protoforge" :modified="true" />
      <div style="padding: 16px; color: var(--fg-3);">macOS · centered title</div>
    </div>
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="windows" title="orders.parquet" subtitle="protoforge" />
      <div style="padding: 16px; color: var(--fg-3);">Windows · min / max / close</div>
    </div>
  </div>
</template>
<CfTitleBar platform="macos" title="orders.parquet" subtitle="protoforge" modified />
<CfTitleBar platform="windows" title="orders.parquet" subtitle="protoforge" />

macOS / Windows / Linux

Same component, platform switches the look. Use hideControls=true for a plain header bar.

背景
orders.parquetprotoforge
orders.parquetprotoforge
orders.parquetprotoforge
只标题(隐藏控件)
<script setup lang="ts">
import { CfTitleBar } from '@chufix-design/vue';
</script>

<template>
  <div style="display: flex; flex-direction: column; gap: 12px;">
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="macos" title="orders.parquet" subtitle="protoforge" :modified="true" size="sm" />
    </div>
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="windows" title="orders.parquet" subtitle="protoforge" :modified="true" />
    </div>
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="linux" title="orders.parquet" subtitle="protoforge" size="lg" />
    </div>
    <div style="border: 1px solid var(--line-1); border-radius: var(--r-6); overflow: hidden;">
      <CfTitleBar platform="macos" title="只标题(隐藏控件)" hide-controls />
    </div>
  </div>
</template>
<CfTitleBar platform="macos" title="…" subtitle="…" modified />
<CfTitleBar platform="windows" title="…" subtitle="…" />
<CfTitleBar platform="linux" title="…" />

API

PropTypeDefaultDescription
platform'macos' | 'windows' | 'linux''macos'Visual variant
title / subtitlestring
modifiedbooleanfalseShow unsaved indicator dot
size'sm' | 'md' | 'lg''md'28 / 32 / 36 px
hideControlsbooleanfalseHide window controls; useful as a plain header

Events: minimize / maximize / close.

反馈与讨论

Title bar · Discussion

0
0 / 600
一键发送
正在加载评论...