Skip to content

Commit

Permalink
feat: add option className/title type and feature (#1020)
Browse files Browse the repository at this point in the history
* ✨ feat(options):  add className title type

* ✨ feat(group options): add custom className
  • Loading branch information
lqzhgood committed Jan 13, 2024
1 parent c93ff10 commit b190480
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -40,4 +40,5 @@ tsconfig.test.json
.umi
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.dumi/tmp-production
.history
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -157,6 +157,8 @@ export default () => (
| label | group label | String/React.Element | - |
| key | - | String | - |
| value | default filter by this attribute. if react want you to set key, then key is same as value, you can omit value | String | - |
| className | same as `Option props` | String | '' |
| title | same as `Option props`| String | - |

## Development

Expand Down
4 changes: 3 additions & 1 deletion docs/examples/optgroup.tsx
Expand Up @@ -18,8 +18,10 @@ const Test = () => (
onChange={onChange}
options={[{
label: 'manager',
className: 'group-custom-className',
title:'group-custom-class',
options: [
{ label: 'jack', value: 'jack' },
{ label: 'jack', value: 'jack', className:'jackClass1 jackClass2' , title:'jack-custom-Title' },
{ label: 'lucy', value: 'lucy' }
],
}, {
Expand Down
2 changes: 1 addition & 1 deletion src/OptionList.tsx
Expand Up @@ -319,7 +319,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, {}> = (_, r

return (
<div
className={classNames(itemPrefixCls, `${itemPrefixCls}-group`)}
className={classNames(itemPrefixCls, `${itemPrefixCls}-group`, data.className)}
title={groupTitle}
>
{label !== undefined ? label : key}
Expand Down
2 changes: 2 additions & 0 deletions src/Select.tsx
Expand Up @@ -91,6 +91,8 @@ export interface FieldNames {

export interface BaseOptionType {
disabled?: boolean;
className?: string;
title?: string;
[name: string]: any;
}

Expand Down

1 comment on commit b190480

@vercel
Copy link

@vercel vercel bot commented on b190480 Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

select – ./

select.vercel.app
select-react-component.vercel.app
select-git-master-react-component.vercel.app

Please sign in to comment.