Navigated to /docs/ui/components/chip

Chip

Compact selected, filter, or metadata token.

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.

TSX
tsximport { Chip } from "@tavojs/ui/chip";

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

When to use

Use it when

Use `Chip` for selectable-looking tags, filters, and compact tokens

Choose something else when

Avoid Chip when replacing interactive controls with content-only components.

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.

Chip example

TSXCreate: src/components/examples/ChipExample1.tsx
tsximport { Chip } from "@tavojs/ui/chip";

export function ChipExample1() {
  return (
    <>
      <Chip tone="primary" selected>Active</Chip>
    </>
  );
}

Common props and defaults

A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.

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.
toneTone

Configures tone for this component.
sizeSize

Configures size for this component.
selectedboolean

Configures selected for this component.
disabledboolean

Configures disabled for this component.

Complete TypeScript API

Import from @tavojs/ui/chip. Published exports: Chip, ChipProps.

ChipProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Chip.

classNamestring

No

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

sxSx

No

Inherited sx attribute accepted by Chip.

idstring

No

Inherited id attribute accepted by Chip.

rolestring

No

Inherited role attribute accepted by Chip.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Chip.

titlestring

No

Inherited title attribute accepted by Chip.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Chip.

hiddenboolean

No

Inherited hidden attribute accepted by Chip.

disabledboolean

No

Configures disabled for this component.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Chip.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Chip.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Chip.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Chip.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Chip.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Chip.

asPolymorphicAs

No

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

toneTone

No

Configures tone for this component.

sizeSize

No

Configures size for this component.

selectedboolean

No

Configures selected for this component.

removableboolean

No

Inherited removable attribute accepted by Chip.

removeLabelstring

No

Inherited removeLabel attribute accepted by Chip.

onRemove() => void

No

Inherited onRemove attribute accepted by Chip.

leadingChild

No

Inherited leading attribute accepted by Chip.

State ownership and DOM target

ConcernContract
StateProps describe the displayed state. Update them from application data; the component does not fetch or advance that state itself.
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 Chip when replacing interactive controls with content-only components.

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

Content components should keep meaningful text and media alternatives available to assistive technology.

  • Provide alt text for meaningful images.

  • Use semantic text variants for headings and paragraphs.

  • Do not hide essential content visually unless VisuallyHidden is intentional.

Component status

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