mergeProps

Utilities
Local guide ↗

Composable props

Chain handlers in order while merging class and style values into one spreadable object

Handler trace

Click the merged button to record call order.

Merged output

class: btn w-full justify-center border-brand-500 bg-ink-800 text-brand-400

style: border-width: 2px; padding-block: 0.8rem; letter-spacing: 0.08em; border-radius: 9999px;

Both handlers run in merge order.

mergeProps is the safe boundary between a headless component's behavior props and consumer props. Event handlers run in argument order, but calling event.preventDefault() stops every later event handler in the merged chain. Non-event functions are also chained, without cancellation semantics.

Classes are combined with clsx. Styles may be strings or objects and are normalized into one style string; when the same CSS property appears more than once, the later props object wins. This is also the merge behavior Bits UI uses internally for rest props and child-snippet props.