AllenFang / AllenFang/react-bootstrap-dropdown

[Proposal] icon

未关闭
#2 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
6
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

Hi @AllenFang,

It would be great to add possibility for setting an icon the current selected item (not visible in the list). My proposal would be:
- add a `iconClass` property into the `item`
- in `DropDown` add a new state `selectedItem` which would be used for rendering the title for button
- add a new optional prop `selectedItem` which would pre-fill the `selectedItem` state
- in `componentDidMount` we would check if `selectedItem` prop is set and will pre-fill the `selectedItem` state , if `title` is provided instead of `selectedItem`, we would build an item with only `text` property.

These changes would add new way how to set and render the button title without breaking old settings.

Do you agree? I can make the changes.

Martin.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。