TitleBar
A custom, draggable title bar with native minimize, maximize and close controls.
Import
import { TitleBar } from "@tarve/core";Usage
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 |
|---|---|---|
actions After the title (before the window controls on desktop): icon buttons, a search field. | Child | — |
appearance Light or dark glass; sets the ink of the title and controls. Default `light`. | "light" | "dark" | "light" |
buttonStyle Style merged into each window control (minimize, maximize, close): size, radius, colours. | Style | — |
glass 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. | boolean | GlassVariant | — |
height | number | MOBILE ? 56 : 40 |
leading Before the title: a menu button, an avatar. Replaces the back button `onBack` draws. | Child | — |
onBack Draws a back arrow before the title that calls this: the usual top bar of a pushed screen. | () => void | — |
showClose | boolean | !MOBILE |
showMaximize | boolean | !MOBILE |
showMinimize | boolean | !MOBILE |
title | string | — |
Inherited from ViewProps 14 props
| Prop | Type | Default |
|---|---|---|
align | Style["align"] | — |
autoFocus Focus this control when it first appears (HTML `autofocus`); interactive views only (Pressable). | boolean | — |
children | BindableChild | — |
dismissOnOutside 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. | boolean | — |
dragRegion | boolean | — |
flex CSS `flex`: `1` is `1 1 0`; strings take any CSS value, e.g. `"1 1 176px"`. | number | string | — |
focusable | boolean | — |
gap | number | — |
justify | Style["justify"] | — |
onOutsideClick With `dismissOnOutside`: a press (or right click) outside the box. | () => void | — |
padding | Style["padding"] | — |
portal | boolean | — |
style Values may be signals: setting one restyles this box without a render. | Reactive<Style> | — |
windowAction | "minimize" | "toggleMaximize" | "toggleFullscreen" | "close" | — |
Common props
Shared by every component. See descriptions →
classclassNamedropTargetfileDropTargethighlightidkeymotionFromonDragEnteronDragLeaveonDroponFileDragEnteronFileDragLeaveonFileDroponHighlightonPasteonPointerLeaveonPointerMoveonSizeonTransitionEndrovingGroupTypes
type BindableChild = Child | Signal<unknown> | BindableChild[];type GlassVariant = "regular" | "clear" | "tinted";type Reactive<S> = { [K in keyof S]: S[K] | Signal<Exclude<S[K], undefined>> };