ant-design/components/space/demo/align.md
Chang Wei bfa8aaec5e
feat: Space support align stretch (#36310)
* feat/Space-component-support-align-stretch: support align to stretch

Signed-off-by: Chang Wei <changwei1006@gmail.com>

* feat/Space-component-support-align-stretch: update document of zh-CN and en-US

Signed-off-by: Chang Wei <changwei1006@gmail.com>

* feat/Space-component-support-align-stretch: update demo

Signed-off-by: Chang Wei <changwei1006@gmail.com>

* feat/Space-component-support-align-stretch: update snapshot by command `npm test -- components/space -u`

Signed-off-by: Chang Wei <changwei1006@gmail.com>
2022-07-05 16:37:50 +08:00

1.6 KiB

order title
3
zh-CN en-US
对齐 Align

zh-CN

设置对齐模式。

en-US

Config item align.

import { Button, Space } from 'antd';
import React from 'react';

const App: React.FC = () => (
  <div className="space-align-container">
    <div className="space-align-block">
      <Space align="center">
        center
        <Button type="primary">Primary</Button>
        <span className="mock-block">Block</span>
      </Space>
    </div>
    <div className="space-align-block">
      <Space align="start">
        start
        <Button type="primary">Primary</Button>
        <span className="mock-block">Block</span>
      </Space>
    </div>
    <div className="space-align-block">
      <Space align="end">
        end
        <Button type="primary">Primary</Button>
        <span className="mock-block">Block</span>
      </Space>
    </div>
    <div className="space-align-block">
      <Space align="baseline">
        baseline
        <Button type="primary">Primary</Button>
        <span className="mock-block">Block</span>
      </Space>
    </div>
    <div className="space-align-block">
      <Space align="stretch">
        stretch
        <Button type="primary">Primary</Button>
        <span className="mock-block">Block</span>
      </Space>
    </div>
  </div>
);

export default App;
.space-align-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
.space-align-block {
  flex: none;
  margin: 8px 4px;
  padding: 4px;
  border: 1px solid #40a9ff;
}
.space-align-block .mock-block {
  display: inline-block;
  padding: 32px 8px 16px;
  background: rgba(150, 150, 150, 0.2);
}