mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
docs: segmented update (#35171)
* docs: segmented update * test: fix lint
This commit is contained in:
parent
91a7e8ba63
commit
3511642337
@ -16,10 +16,7 @@ The most basic usage.
|
|||||||
```jsx
|
```jsx
|
||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => <Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />;
|
||||||
<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />,
|
|
||||||
mountNode,
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
|
@ -16,8 +16,7 @@ title:
|
|||||||
```jsx
|
```jsx
|
||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => (
|
||||||
<Segmented block options={[123, 456, 'longtext-longtext-longtext-longtext']} />,
|
<Segmented block options={[123, 456, 'longtext-longtext-longtext-longtext']} />
|
||||||
mountNode,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -13,12 +13,12 @@ title:
|
|||||||
|
|
||||||
Controlled Segmented.
|
Controlled Segmented.
|
||||||
|
|
||||||
```jsx
|
```tsx
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
|
|
||||||
const Demo: React.FC = () => {
|
const Demo: React.FC = () => {
|
||||||
const [value, setValue] = useState('Map');
|
const [value, setValue] = useState<string | number>('Map');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Segmented
|
<Segmented
|
||||||
@ -29,5 +29,5 @@ const Demo: React.FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ReactDOM.render(<Demo />, mountNode);
|
export default Demo;
|
||||||
```
|
```
|
||||||
|
@ -17,7 +17,7 @@ Custom each Segmented Item by ReactNode.
|
|||||||
import { Avatar, Segmented } from 'antd';
|
import { Avatar, Segmented } from 'antd';
|
||||||
import { UserOutlined } from '@ant-design/icons';
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => (
|
||||||
<>
|
<>
|
||||||
<Segmented
|
<Segmented
|
||||||
options={[
|
options={[
|
||||||
@ -91,7 +91,6 @@ ReactDOM.render(
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</>,
|
</>
|
||||||
mountNode,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ Disabled Segmented.
|
|||||||
```jsx
|
```jsx
|
||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => (
|
||||||
<>
|
<>
|
||||||
<Segmented options={['Map', 'Transit', 'Satellite']} disabled />
|
<Segmented options={['Map', 'Transit', 'Satellite']} disabled />
|
||||||
<br />
|
<br />
|
||||||
@ -29,7 +29,6 @@ ReactDOM.render(
|
|||||||
'Yearly',
|
'Yearly',
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</>,
|
</>
|
||||||
mountNode,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -16,14 +16,13 @@ There are three sizes of an Segmented: `large` (40px), `default` (32px) and `sma
|
|||||||
```jsx
|
```jsx
|
||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => (
|
||||||
<>
|
<>
|
||||||
<Segmented size="large" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
<Segmented size="large" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
||||||
<br />
|
<br />
|
||||||
<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
||||||
<br />
|
<br />
|
||||||
<Segmented size="small" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
<Segmented size="small" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
|
||||||
</>,
|
</>
|
||||||
mountNode,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -17,7 +17,7 @@ Set `icon` for Segmented Item.
|
|||||||
import { Segmented } from 'antd';
|
import { Segmented } from 'antd';
|
||||||
import { AppstoreOutlined, BarsOutlined } from '@ant-design/icons';
|
import { AppstoreOutlined, BarsOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
ReactDOM.render(
|
export default () => (
|
||||||
<Segmented
|
<Segmented
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
@ -31,7 +31,6 @@ ReactDOM.render(
|
|||||||
icon: <AppstoreOutlined />,
|
icon: <AppstoreOutlined />,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>,
|
/>
|
||||||
mountNode,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user