trigger icon indicating copy to clipboard operation
trigger copied to clipboard

[Proposal] Add topmost className prop and merge it into trigger element

Open yenshih opened this issue 7 years ago • 1 comments

Due to this issue: https://github.com/ant-design/ant-design/issues/10325, I suggest that we add className as a prop of Trigger for convenience.

Current

const props = this.props;
const children = props.children;
const child = React.Children.only(children);
const newChildProps = { key: 'trigger' };

// Merge some event handlers into `newChildProps`

const trigger = React.cloneElement(child, newChildProps);

Expected

import classNames from 'classnames';

// ...

const props = this.props;
const children = props.children;
const child = React.Children.only(children);
const newChildProps = {
    key: 'trigger',
    className: classNames(props.className, child.props.className),
};

// Merge some event handlers into `newChildProps`

const trigger = React.cloneElement(child, newChildProps);
name type default description
className string   additional className added to trigger

@yesmeck Shall I create a PR directly? Thanks.

yenshih avatar May 04 '18 10:05 yenshih

ping~ @afc163 @yiminghe @yesmeck

yenshih avatar May 09 '18 05:05 yenshih