View
The base box. Flexbox/Grid layout, styling and events for anything you render.
Import
import { View } from "@tarve/core";Usage
import { Text, View, theme } from "@tarve/core";
<View
padding={16}
style={{
background: theme.colors.card,
borderWidth: 1,
borderColor: theme.colors.border,
radius: 12,
boxShadow: { y: 8, blur: 24, color: "#0f172a22" },
}}
>
<Text>Any content goes here.</Text>
</View>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 Reactive<S> = { [K in keyof S]: S[K] | Signal<Exclude<S[K], undefined>> };