classNameやイベントハンドラを適切にマージして複数のpropsを合成するユーティリティ
baseRecord<string, unknown>overrideRecord<string, unknown>| Prop | Type | Default |
|---|---|---|
base | Record<string, unknown> | - |
override | Record<string, unknown> | - |
mergedPropsOmit<A, keyof B> & B| Prop | Type | Default |
|---|---|---|
mergedProps | Omit<A, keyof B> & B | - |
Both onClick handlers run; classNames merged with cn.
import { mergeProps } from '@k8ordo/ui';const merged = mergeProps(
{ className: 'p-2', onClick: () => log('a') },
{ className: 'text-fg-info', onClick: () => log('b') },
);
// className: 'p-2 text-fg-info' (cn merged)
// onClick: chained — calls 'a' then 'b'