Navigated to /docs/ui/components/button-group

ButtonGroup

Grouped action container for related buttons.

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 { ButtonGroup } from "@tavojs/ui/button-group";

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/button-group.

When to use

Use it when

Use `ButtonGroup` to group related button actions

Choose something else when

Avoid ButtonGroup when wrapping controls without labels or accessible names.

Examples

ButtonGroup example

TSX
tsximport { ButtonGroup } from "@tavojs/ui/button-group";
import { Button } from "@tavojs/ui";

export function ButtonGroupExample1() {
  return (
    <>
      <ButtonGroup tone="neutral" variant="outline">
        <Button>Day</Button>
        <Button variant="soft">Week</Button>
      </ButtonGroup>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
orientation"horizontal" | "vertical"

Configures orientation for this component.
fullWidthboolean

Configures fullWidth for this component.
tone"primary" | "secondary" | "neutral" | "danger"

Configures tone for this component.
variant"solid" | "soft" | "outline" | "ghost" | "text"

Configures variant for this component.

Complete TypeScript API

Import from @tavojs/ui/button-group. Published exports: ButtonGroup, ButtonGroupProps.

ButtonGroupProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by ButtonGroup.

classNamestring

No

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

sxSx

No

Inherited sx attribute accepted by ButtonGroup.

idstring

No

Inherited id attribute accepted by ButtonGroup.

rolestring

No

Inherited role attribute accepted by ButtonGroup.

styleRecord<string, unknown>

No

Inherited style attribute accepted by ButtonGroup.

titlestring

No

Inherited title attribute accepted by ButtonGroup.

tabIndexnumber

No

Inherited tabIndex attribute accepted by ButtonGroup.

hiddenboolean

No

Inherited hidden attribute accepted by ButtonGroup.

disabledboolean

No

Inherited disabled attribute accepted by ButtonGroup.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by ButtonGroup.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by ButtonGroup.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by ButtonGroup.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by ButtonGroup.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by ButtonGroup.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by ButtonGroup.

orientation"horizontal" | "vertical"

No

Configures orientation for this component.

fullWidthboolean

No

Configures fullWidth for this component.

tone"danger" | "neutral" | "primary" | "secondary"

No

Configures tone for this component.

variant"solid" | "soft" | "outline" | "ghost" | "text"

No

Configures variant 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

Avoid ButtonGroup when wrapping controls without labels or accessible names.

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/button-group
Explicit CSS import@tavojs/ui/css/button-group
PreviewInteractive preview available on this page