# TitleBar

> A custom, draggable title bar with native minimize, maximize and close controls.

- Category: [Window & layout](https://tarve.dev/docs.md#layout)
- Import: `import { TitleBar } from "@tarve/core";`
- Props type: `TitleBarProps`
- Source: [packages/core/src/components/titlebar.ts:79](https://github.com/omarcosr/tarve/blob/main/packages/core/src/components/titlebar.ts#L79)

## Usage

```tsx title="TitleBar.tsx"
import { Badge, Column, Row, Text, TitleBar, Window, darkTheme } from "@tarve/core";

<Window title="Editor" width={720} height={280} theme={darkTheme}>
  <TitleBar height={40} showMaximize={false}>
    <Row gap={8} align="center" padding={12}>
      <Text weight={600}>Editor</Text>
      <Badge variant="secondary">main.ts</Badge>
    </Row>
  </TitleBar>
  <Column flex={1} padding={24}>
    <Text>Window content</Text>
  </Column>
</Window>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `actions` | `Child` | — | After the title (before the window controls on desktop): icon buttons, a search field. |
| `appearance` | `"light" \| "dark"` | `"light"` | Light or dark glass; sets the ink of the title and controls. Default `light`. |
| `buttonStyle` | `Style` | — | Style merged into each window control (minimize, maximize, close): size, radius, colours. |
| `glass` | `boolean \| GlassVariant` | — | Liquid Glass bar: `true` for the `regular` material, or a variant. Its controls go round. Edge to edge (no `radius` in `style`) it keeps only a hairline along its bottom; with a `radius` it is a floating capsule with the full rim and shadow. Lay it over content (`position: "absolute"`) for the backdrop to show through, as the window background alone is only the veil. |
| `height` | `number` | `MOBILE ? 56 : 40` |  |
| `leading` | `Child` | — | Before the title: a menu button, an avatar. Replaces the back button `onBack` draws. |
| `onBack` | `() => void` | — | Draws a back arrow before the title that calls this: the usual top bar of a pushed screen. |
| `showClose` | `boolean` | `!MOBILE` |  |
| `showMaximize` | `boolean` | `!MOBILE` |  |
| `showMinimize` | `boolean` | `!MOBILE` |  |
| `title` | `string` | — |  |

### Inherited from `ViewProps`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `Style["align"]` | — |  |
| `autoFocus` | `boolean` | — | Focus this control when it first appears (HTML `autofocus`); interactive views only (Pressable). |
| `children` | `BindableChild` | — |  |
| `dismissOnOutside` | `boolean` | — | A press outside the box fires `onOutsideClick` instead of reaching what is under it (light dismiss). Works on portals and in-flow boxes; an open portal wins. |
| `dragRegion` | `boolean` | — |  |
| `flex` | `number \| string` | — | CSS `flex`: `1` is `1 1 0`; strings take any CSS value, e.g. `"1 1 176px"`. |
| `focusable` | `boolean` | — |  |
| `gap` | `number` | — |  |
| `justify` | `Style["justify"]` | — |  |
| `onOutsideClick` | `() => void` | — | With `dismissOnOutside`: a press (or right click) outside the box. |
| `padding` | `Style["padding"]` | — |  |
| `portal` | `boolean` | — |  |
| `style` | `Reactive<Style>` | — | Values may be signals: setting one restyles this box without a render. |
| `windowAction` | `"minimize" \| "toggleMaximize" \| "toggleFullscreen" \| "close"` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `class`, `className`, `dropTarget`, `fileDropTarget`, `highlight`, `id`, `key`, `motionFrom`, `onDragEnter`, `onDragLeave`, `onDrop`, `onFileDragEnter`, `onFileDragLeave`, `onFileDrop`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`.

## Types

```ts title="BindableChild"
type BindableChild = Child | Signal<unknown> | BindableChild[];
```

```ts title="GlassVariant"
type GlassVariant = "regular" | "clear" | "tinted";
```

```ts title="Reactive"
type Reactive<S> = { [K in keyof S]: S[K] | Signal<Exclude<S[K], undefined>> };
```

Previous: [Window](https://tarve.dev/docs/components/Window.md) · Next: [View](https://tarve.dev/docs/components/View.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/TitleBar · Index for agents: https://tarve.dev/llms.txt
