trigger
trigger copied to clipboard
[Proposal] Add topmost className prop and merge it into trigger element
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.
ping~ @afc163 @yiminghe @yesmeck