Navigated to /docs/ui/components/form-control

FormControl

Native form submission boundary with optional full-width layout styling.

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 { FormControl } from "@tavojs/ui/form-control";

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/form-control.

When to use

Use it when

Use FormControl to group fields and submit actions inside a real form element.

Choose something else when

Do not use FormControl as a replacement for Field. It does not create labels, hints, validation messages, or ARIA relationships for individual controls.

Examples

FormControl example

TSX
tsximport { FormControl } from "@tavojs/ui/form-control";
import { TextInput } from "@tavojs/ui";

export function FormControlExample1() {
  return (
    <>
      <FormControl fullWidth><TextInput /></FormControl>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

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

Configures fullWidth for this component.

Complete TypeScript API

Import from @tavojs/ui/form-control. Published exports: FormControl, FormControlProps.

FormControlProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by FormControl.

classNamestring

No

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

sxSx

No

Inherited sx attribute accepted by FormControl.

idstring

No

Inherited id attribute accepted by FormControl.

rolestring

No

Inherited role attribute accepted by FormControl.

styleRecord<string, unknown>

No

Inherited style attribute accepted by FormControl.

titlestring

No

Inherited title attribute accepted by FormControl.

tabIndexnumber

No

Inherited tabIndex attribute accepted by FormControl.

hiddenboolean

No

Inherited hidden attribute accepted by FormControl.

disabledboolean

No

Inherited disabled attribute accepted by FormControl.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by FormControl.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by FormControl.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by FormControl.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by FormControl.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by FormControl.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by FormControl.

fullWidthboolean

No

Configures fullWidth 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 targetNative input attributes target the owned form control; wrapper-specific props stay on the documented component root.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Do not use FormControl as a replacement for Field. It does not create labels, hints, validation messages, or ARIA relationships for individual controls.

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

Form components pass through native attributes and should be paired with visible labels or accessible names.

  • Use Field, FormLabel, FormControlLabel, or aria-label for labeling.

  • Preserve native input semantics whenever possible.

  • Expose validation with error text and aria-invalid where relevant.

Component status

ContractCurrent value
Maturitystable
Categoryforms
Component import@tavojs/ui/form-control
Explicit CSS import@tavojs/ui/css/form-control
PreviewInteractive preview available on this page