Skip to content
CCinder
Using DOM Adapters

Guides

Using DOM Adapters

Handle custom controls and framework widgets when standard DOM execution is not enough.

Use DOM adapters for controls that do not behave like normal browser inputs, buttons, or forms.

Typical example

ts
10 lines
Cinder.registerDomAdapter({
  id: 'custom-combobox',
  match(context) {
    return context.element.getAttribute('role') === 'combobox';
  },
  async execute(context) {
    context.element.dispatchEvent(new Event('click', { bubbles: true }));
    return true;
  },
});

Good adapter use cases

  • headless UI widgets
  • custom dropdowns
  • design-system components that hide native inputs
  • framework-specific surfaces that need explicit interaction logic

Bad adapter use cases

Do not reach for an adapter when standard browser behavior already works. The first question should be:

can this be solved through better tags or the normal DOM path first?

Continue reading