Skip to main content
A Vertz component is a plain function that returns JSX. It runs once to create the DOM — reactivity is handled by signals and effects, not by re-running the function.

Pre-built themed components

Vertz ships a library of pre-built, themed components. Import them from @vertz/ui/components:
Themed components require registerTheme() to be called first — typically in your src/styles/theme.ts. See Component Library for setup.
Available components:
CategoryComponents
BasicButton, Input, Label, Badge, Textarea, Separator
LayoutAppShell, Card, Card.Header, Card.Content, Card.Footer
DataTable, Table.Header, Table.Body, Table.Row, Table.Cell
FeedbackAlert, Skeleton, EmptyState, Toast, Progress
OverlayDialog, Sheet, Drawer, Popover, Tooltip, HoverCard
NavigationTabs, Accordion, Breadcrumb, Pagination, NavigationMenu
FormFormGroup, Select, RadioGroup, Checkbox, Switch, Toggle, DatePicker
IdentityAvatar, Avatar.Image, Avatar.Fallback
Prefer themed components over raw HTML elements. Use css() only for layout-specific styles that don’t correspond to a component.

Basic component

Use it with JSX:

Props

Define a ComponentNameProps interface with on prefix for callbacks. Destructure props in the function parameter:
See Conventions for the full list of naming and style conventions.

Children

Use the children helper to access child content passed via JSX:
Usage:

Conditional rendering

Use && for show/hide and ternary for either/or:
The compiler transforms these into reactive conditionals — when task.status changes, only the affected branch updates. No re-render of the entire component.

Lists

Use .map() with a key prop:
The key prop tells the runtime how to efficiently update the list when items are added, removed, or reordered.

Events

Attach event handlers directly in JSX:
Event handlers are standard DOM event handlers. The callback receives the native DOM event.

Composition

Compose components with JSX — never call them as functions.
Calling a component as a function bypasses the compiler’s reactive prop generation. Always use JSX.

Refs

Access the underlying DOM element with ref():

Lifecycle

Components run once, but you can hook into mount with onMount():
onMount runs after the component’s DOM is inserted. The optional cleanup function runs when the component is removed.

Compound components

Compound components are groups of related components designed to work together — like Card with CardHeader, CardContent, and CardFooter, or Dialog with Dialog.Header, Dialog.Title, and Dialog.Footer.

Render children in order

Compound components should render children in the order the developer provides them. Don’t inspect or reorganize children into “correct” slots:
If a developer puts CardFooter before CardContent, they’ll see the footer first — that’s their responsibility, not the component’s. Reordering children adds complexity and can cause issues with hydration, where the client-side DOM structure must match what the server rendered.

Use props for structure, not child inspection

When a component genuinely needs to control layout, use explicit props instead of scanning children:
This makes the API explicit and avoids the fragility of child-type detection.