-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(design): checked and disabled Radio.Button style
- Loading branch information
1 parent
18249cf
commit 1eb26e6
Showing
5 changed files
with
93 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
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,36 @@ | ||
import React from 'react'; | ||
import { Radio, Space } from '@oceanbase/design'; | ||
import type { RadioChangeEvent } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => { | ||
const onChange = (e: RadioChangeEvent) => { | ||
console.log(`radio checked:${e.target.value}`); | ||
}; | ||
|
||
return ( | ||
<Space direction="vertical" size="middle"> | ||
<Radio.Group onChange={onChange} defaultValue="a"> | ||
<Radio.Button value="a">Hangzhou</Radio.Button> | ||
<Radio.Button value="b">Shanghai</Radio.Button> | ||
<Radio.Button value="c">Beijing</Radio.Button> | ||
<Radio.Button value="d">Chengdu</Radio.Button> | ||
</Radio.Group> | ||
<Radio.Group onChange={onChange} defaultValue="a"> | ||
<Radio.Button value="a">Hangzhou</Radio.Button> | ||
<Radio.Button value="b" disabled> | ||
Shanghai | ||
</Radio.Button> | ||
<Radio.Button value="c">Beijing</Radio.Button> | ||
<Radio.Button value="d">Chengdu</Radio.Button> | ||
</Radio.Group> | ||
<Radio.Group disabled onChange={onChange} defaultValue="a"> | ||
<Radio.Button value="a">Hangzhou</Radio.Button> | ||
<Radio.Button value="b">Shanghai</Radio.Button> | ||
<Radio.Button value="c">Beijing</Radio.Button> | ||
<Radio.Button value="d">Chengdu</Radio.Button> | ||
</Radio.Group> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default App; |
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,31 @@ | ||
import React, { useState } from 'react'; | ||
import { Radio, Space } from '@oceanbase/design'; | ||
import type { RadioChangeEvent } from '@oceanbase/design'; | ||
|
||
const App: React.FC = () => { | ||
const [value, setValue] = useState('A'); | ||
|
||
const onChange = (e: RadioChangeEvent) => { | ||
console.log('radio checked', e.target.value); | ||
setValue(e.target.value); | ||
}; | ||
|
||
return ( | ||
<Space direction="vertical"> | ||
<Radio.Group onChange={onChange} value={value}> | ||
<Radio value="A">A</Radio> | ||
<Radio value="B">B</Radio> | ||
<Radio value="C">C</Radio> | ||
<Radio value="D">D</Radio> | ||
</Radio.Group> | ||
<Radio.Group onChange={onChange} value={value} disabled={true}> | ||
<Radio value="A">A</Radio> | ||
<Radio value="B">B</Radio> | ||
<Radio value="C">C</Radio> | ||
<Radio value="D">D</Radio> | ||
</Radio.Group> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default App; |
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,21 @@ | ||
--- | ||
title: Radio 单选框 | ||
nav: | ||
title: 基础组件 | ||
path: /components | ||
demo: | ||
cols: 2 | ||
--- | ||
|
||
- 🔥 完全继承 antd [Radio](https://ant.design/components/radio-cn) 的能力和 API,可无缝切换。 | ||
- 💄 定制主题和样式,符合 OceanBase Design 设计规范。 | ||
|
||
## 代码演示 | ||
|
||
<!-- prettier-ignore --> | ||
<code src="./demo/radio.tsx" title="单选"></code> | ||
<code src="./demo/radio-button.tsx" title="单选按钮"></code> | ||
|
||
## API | ||
|
||
- 详见 antd Radio 文档: https://ant.design/components/radio-cn |
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