FormControlLabel
Clickable label composition for checkbox, radio, and switch controls.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.
tsximport { FormControlLabel } from "@tavojs/ui/form-control-label";The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/form-control-label.
When to use
Use it when
Choose something else when
Examples
These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.
FormControlLabel example
tsximport { FormControlLabel } from "@tavojs/ui/form-control-label";
import { Checkbox } from "@tavojs/ui";
export function FormControlLabelExample1() {
return (
<>
<FormControlLabel label="Subscribe" control={<Checkbox />} />
</>
);
}Common props and defaults
A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
label | Child | — | Configures label for this component. |
control | Child | — | Configures control for this component. |
size | Size | — | Configures size for this component. |
Complete TypeScript API
Import from @tavojs/ui/form-control-label. Published exports: FormControlLabel, FormControlLabelProps.
FormControlLabelProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by FormControlLabel. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by FormControlLabel. |
id | string | No | Inherited id attribute accepted by FormControlLabel. |
role | string | No | Inherited role attribute accepted by FormControlLabel. |
style | Record<string, unknown> | No | Inherited style attribute accepted by FormControlLabel. |
title | string | No | Inherited title attribute accepted by FormControlLabel. |
tabIndex | number | No | Inherited tabIndex attribute accepted by FormControlLabel. |
hidden | boolean | No | Inherited hidden attribute accepted by FormControlLabel. |
disabled | boolean | No | Inherited disabled attribute accepted by FormControlLabel. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by FormControlLabel. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by FormControlLabel. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by FormControlLabel. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by FormControlLabel. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by FormControlLabel. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by FormControlLabel. |
label | Child | No | Configures label for this component. |
control | Child | No | Configures control for this component. |
size | Size | No | Configures size 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 | Native input attributes target the owned form control; wrapper-specific props stay on the documented component root. |
Anatomy and related components
Limitations
Use Field for text-like inputs that need a label above the control plus hints, errors, success, or warning messages.
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
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | forms |
| Component import | @tavojs/ui/form-control-label |
| Explicit CSS import | @tavojs/ui/css/form-control-label |
| Preview | Interactive preview available on this page |