[Proposal] Add topmost className prop and merge it into trigger element
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start at the Trigger implementation's child-cloning path described in the issue and inspect how props are merged into the trigger element. Add the proposed top-level className behavior, preserving the child's className, and verify that the resulting trigger receives both classes.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 391
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-component/trigger
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
react-component/trigger#593 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
react-component/trigger#623 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
react-component/trigger#618 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
react-component/trigger#555 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
react-component/trigger#550 · 1 comment ·
All issues in react-component/trigger
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·