将元素推到两侧 Antd(一个向左对齐,一个向右对齐)

Push elements to the sides Antd (align one to the left and one to the right)

我正在使用 Antd with React。我想在两个元素之间添加一个 space,这样一个元素在左侧对齐,另一个元素在最大可用 space 的右侧对齐。请参阅带有文本和开关的附加图像。

这可以使用 Grid 在其中添加贪婪的 Col 来实现:

<Form.Item>
    <Row>
        <Col><Typography>Essential</Typography></Col>
        <Col flex="auto"></Col>
        <Col ><Switch defaultChecked /></Col>
    </Row>
</Form.Item>