AppBar
Top application bar for navigation and product actions.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { AppBar } from "@tavojs/ui/app-bar";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/app-bar.
When to use
Use it when
Choose something else when
Examples
AppBar example
tsximport { AppBar } from "@tavojs/ui/app-bar";
import { Toolbar } from "@tavojs/ui";
export function AppBarExample1() {
return (
<>
<AppBar align="center" justify="between" gap={{ base: "sm", md: "lg" }}>
<Toolbar>...</Toolbar>
</AppBar>
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
as | string | Component<Record<string, unknown>> | — | Changes the rendered root element or component while preserving Tavo.js UI styling and public props. |
position | "static" | "sticky" | "fixed" | "relative" | — | Configures position for this component. |
direction | ResponsiveValue<"row" | "column" | "row-reverse" | "column-reverse"> | — | Configures direction for this component. |
align | ResponsiveValue<"start" | "center" | "end" | "stretch"> | — | Configures align for this component. |
justify | ResponsiveValue<"start" | "center" | "end" | "between" | "around"> | — | Configures justify for this component. |
gap | ResponsiveValue<Gap | number | string> | — | Configures gap for this component. |
sx | Sx | — | Configures sx for this component. |
Complete TypeScript API
Import from @tavojs/ui/app-bar. Published exports: AppBar, AppBarProps.
AppBarProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by AppBar. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Configures sx for this component. |
id | string | No | Inherited id attribute accepted by AppBar. |
role | string | No | Inherited role attribute accepted by AppBar. |
style | Record<string, unknown> | No | Inherited style attribute accepted by AppBar. |
title | string | No | Inherited title attribute accepted by AppBar. |
tabIndex | number | No | Inherited tabIndex attribute accepted by AppBar. |
hidden | boolean | No | Inherited hidden attribute accepted by AppBar. |
disabled | boolean | No | Inherited disabled attribute accepted by AppBar. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by AppBar. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by AppBar. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by AppBar. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by AppBar. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by AppBar. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by AppBar. |
direction | ResponsiveValue<FlexDirection> | No | Configures direction for this component. |
align | ResponsiveValue<FlexAlign> | No | Configures align for this component. |
justify | ResponsiveValue<FlexJustify> | No | Configures justify for this component. |
gap | ResponsiveValue<string | number> | No | Configures gap for this component. |
as | PolymorphicAs | No | Changes the rendered root element or component while preserving Tavo.js UI styling and public props. |
position | "static" | "sticky" | "fixed" | "relative" | No | Configures position for this component. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | No component state contract is exposed; the application owns the rendered content and surrounding behavior. |
| DOM target | The public root follows the as/component prop. Root attributes, className, style, and supported events are forwarded there. |
Anatomy and related components
This component exposes one public component root rather than a compound member API.
Limitations
Avoid AppBar when for interactive form state; combine with form, feedback, or data components instead.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Defaults to `header`; use `as="nav"` and labels when the bar is navigational.
Defaults to `header`; use `as="nav"` and labels when the bar is navigational.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | layout |
| Component import | @tavojs/ui/app-bar |
| Explicit CSS import | @tavojs/ui/css/app-bar |
| Preview | Interactive preview available on this page |