Navigated to /docs/ui/components/alert

Alert

Inline status message for success, warning, danger, and info states.

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.

TSX
tsximport { Alert } from "@tavojs/ui/alert";

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/alert.

When to use

Use it when

Use `Alert` for inline feedback that belongs inside page flow

Choose something else when

Avoid Alert when using feedback components as primary page layout.

Examples

Alert example

TSX
tsximport { Alert } from "@tavojs/ui/alert";

export function AlertExample1() {
  return (
    <>
      <Alert title="Saved" tone="success">
        Your changes were stored locally.
      </Alert>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
asstring | Component<Record<string, unknown>>

Changes the rendered root element or component while preserving Tavo.js UI styling and public props.
titleChild

Configures title for this component.
tone"info" | "success" | "warning" | "danger"

Configures tone for this component.

Complete TypeScript API

Import from @tavojs/ui/alert. Published exports: Alert, AlertProps, AlertTone.

AlertProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Alert.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Alert.

idstring

No

Inherited id attribute accepted by Alert.

rolestring

No

Inherited role attribute accepted by Alert.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Alert.

titlestring & Child

No

Configures title for this component.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Alert.

hiddenboolean

No

Inherited hidden attribute accepted by Alert.

disabledboolean

No

Inherited disabled attribute accepted by Alert.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Alert.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Alert.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Alert.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Alert.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Alert.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Alert.

asPolymorphicAs

No

Changes the rendered root element or component while preserving Tavo.js UI styling and public props.

toneAlertTone

No

Configures tone for this component.

State ownership and DOM target

ConcernContract
StateNo component state contract is exposed; the application owns the rendered content and surrounding behavior.
DOM targetThe 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 Alert when using feedback components as primary page layout.

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

Uses `role="status"` by default.

  • Uses `role="status"` by default.

Component status

ContractCurrent value
Maturitystable
Categoryfeedback
Component import@tavojs/ui/alert
Explicit CSS import@tavojs/ui/css/alert
PreviewInteractive preview available on this page