react-component / react-component/select

自定义Select Option样式问题

Open
#944 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

之前在antd Issue其实是有提到这个问题,在自定义设计checkbox多选框的样式后,我觉得是非常麻烦的,我除了要自己控制value之外,还得控制onSearch,onClear,onDeselect等等保证Select的正常运行,但我却仅仅是想改变一个Option的样式仅此而已。

目前在我看来更应该在这里提,我理解rc-select是一个无样式组件,那么在Option自定义环节是否可以参考类似headlessui的设计

<RadioGroup.Option value="startup">
        {({ checked }) => (
          <span className={checked ? 'bg-blue-200' : ''}>Startup</span>
        )}
</RadioGroup.Option>

当然我的例子可能和select无关,我只是想表达我们在设计select option时候能否给使用者更大的样式控制权,组建本身也只是抛出状态,并不会破坏组件本身的逻辑。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing rc-select's custom Option rendering and the Headless UI RadioGroup example linked in the issue. Determine how option state could be exposed without requiring users to control value, search, clear, or deselect behavior; done means a documented design and implementation that preserves Select's existing logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.