Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mui/base-ui/llms.txt
Use this file to discover all available pages before exploring further.
mergeProps
Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object’s fields overwrite the conflicting ones from others. This doesn’t apply to event handlers,className, and style props.
Import
Function Signatures
Parameters
Props object to merge.
Props object to merge. The function will overwrite conflicting props from
a.Props object to merge. The function will overwrite conflicting props from previous parameters.
Props object to merge. The function will overwrite conflicting props from previous parameters.
Props object to merge. The function will overwrite conflicting props from previous parameters.
Return Value
Returns the merged props object of typePropsOf<T>.
Behavior
Event Handlers
Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last). For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing by callingevent.preventBaseUIHandler(). For non-synthetic events (custom events with primitive/object values), all handlers always execute without prevention capability.
className
TheclassName prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).
style
Thestyle prop is merged with rightmost styles overwriting the prior ones.
Function Props
Props can either be provided as objects or as functions that take the previous props as an argument. The function will receive the merged props up to that point (going from left to right): so in the case of(obj1, obj2, fn, obj3), fn will receive the merged props of obj1 and obj2.
Event handlers returned by the functions are not automatically prevented when preventBaseUIHandler is called. They must check event.baseUIHandlerPrevented themselves and bail out if it’s true.
ref Handling
Important:ref is not merged.
Type Definitions
InputProps
PropsOf
mergePropsN
Merges an arbitrary number of React props using the same logic asmergeProps. This function accepts an array of props instead of individual arguments.
Signature
Parameters
Array of props to merge.
Return Value
Returns the merged props object of typePropsOf<T>.
Performance Note
This has slightly lower performance thanmergeProps due to accepting an array instead of a fixed number of arguments. Prefer mergeProps when merging 5 or fewer prop sets for better performance.