mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 21:18:01 +08:00
766ae3b320
* fix: Button icon order and margin in rtl mode * demo: default iconPosition should be end * fix: test case
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
import { Button, Divider, Flex, Radio, Space, Tooltip } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [position, setPosition] = useState<'start' | 'end'>('end');
|
|
|
|
return (
|
|
<>
|
|
<Space>
|
|
<Radio.Group value={position} onChange={(e) => setPosition(e.target.value)}>
|
|
<Radio.Button value="start">start</Radio.Button>
|
|
<Radio.Button value="end">end</Radio.Button>
|
|
</Radio.Group>
|
|
</Space>
|
|
<Divider orientation="left" plain>
|
|
Preview
|
|
</Divider>
|
|
<Flex gap="small" vertical>
|
|
<Flex wrap gap="small">
|
|
<Tooltip title="search">
|
|
<Button type="primary" shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button type="primary" shape="circle">
|
|
A
|
|
</Button>
|
|
<Button type="primary" icon={<SearchOutlined />} iconPosition={position}>
|
|
Search
|
|
</Button>
|
|
<Tooltip title="search">
|
|
<Button shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button icon={<SearchOutlined />} iconPosition={position}>
|
|
Search
|
|
</Button>
|
|
</Flex>
|
|
<Flex wrap gap="small">
|
|
<Tooltip title="search">
|
|
<Button shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button icon={<SearchOutlined />} type="text" iconPosition={position}>
|
|
Search
|
|
</Button>
|
|
<Tooltip title="search">
|
|
<Button type="dashed" shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button type="dashed" icon={<SearchOutlined />} iconPosition={position}>
|
|
Search
|
|
</Button>
|
|
<Button icon={<SearchOutlined />} href="https://www.google.com" iconPosition={position} />
|
|
<Button type="primary" loading iconPosition={position}>
|
|
Loading
|
|
</Button>
|
|
</Flex>
|
|
</Flex>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|