-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2663 from XiaoMi/feature/2662(radio)
feat(radio): feat: add autoWidth api (#2662)
- Loading branch information
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/radio": minor | ||
--- | ||
|
||
feat: add autoWidth api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
Radio feat: add autoWidth api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react' | ||
import Radio from '../src' | ||
|
||
/** | ||
* @title 宽度自适应 | ||
* @desc 仅支持横向按钮组 | ||
*/ | ||
export const AutoWidth = () => { | ||
const RadioGroup = Radio.Group | ||
|
||
const [data] = React.useState([ | ||
{ | ||
id: 0, | ||
title: '手机类', | ||
}, | ||
{ | ||
id: 1, | ||
title: '电脑类', | ||
}, | ||
{ | ||
id: 2, | ||
title: '生活类', | ||
}, | ||
{ | ||
id: 3, | ||
title: '其它', | ||
}, | ||
{ | ||
id: 4, | ||
title: '禁用未选', | ||
disabled: true, | ||
}, | ||
]) | ||
|
||
return ( | ||
<> | ||
<h1>AutoWidth</h1> | ||
<div className="radio-auto-width__wrap"> | ||
<div> | ||
<RadioGroup | ||
defaultValue={0} | ||
type={'button'} | ||
data={data} | ||
autoWidth={true} | ||
onChange={(value) => { | ||
console.log('onChange', value) | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters