--- localeCode: en-US order: 15 category: basic title: Space icon: doc-space brief: Set the spacing between components. --- ## Demos ### How to import ```jsx import import { Space } from '@douyinfe/semi-ui'; ``` ### Basic Usage ```jsx live=true hideInDSM import React from 'react'; import { Space, Button, Switch } from '@douyinfe/semi-ui'; () => ( ); ``` ### Alignment You can use `align` to set the alignment, optional: `start`, `center`(default), `end`, `baseline`. ```jsx live=true hideInDSM import React from 'react'; import { Space, Button, Tag } from '@douyinfe/semi-ui'; () => { const divStyle = { width:80, height:100, lineHight:100, display: 'flex', alignItems: 'center', justifyContent:'center', border:'1px solid var(--semi-color-border)', borderRadius: 3 }; return (
text
tag
text
tag
text
tag
text
tag
); }; ``` ### Spacing You can use `spacing` to set the spacing size, optional: `tight` (8px, default), `medium` (16px), `loose` (24px), and allow to pass in number to customize the spacing size, and also support to pass in array to set the horizontal and vertical spacing at the same time. ```jsx live=true hideInDSM import React from 'react'; import { Space, Tabs, TabPane, Button } from '@douyinfe/semi-ui'; () => ( ); ``` ### Direction You can use `vertical` to set whether the spacing is vertical, the default is false. ```jsx live=true hideInDSM import React from 'react'; import { Space, Button } from '@douyinfe/semi-ui'; () => ( ); ``` ### Wrap When the spacing is horizontal,you can use `wrap` to set whether to wrap automatically, the default is false. ```jsx live=true hideInDSM import React from 'react'; import { Space, Button } from '@douyinfe/semi-ui'; () => ( {new Array(10).fill(null).map((item, idex) => ( ))} ); ``` ## API Reference |Properties|Instructions|Type|Default|Version| |-|-|-|-|-| |align|Alignment, optional: `start`、`end`、`center`、`baseline`|string|`center`|>=1.17.0| |className|Class name|string|-|>=1.17.0| |spacing|The space size, optional: `loose`、`medium`、`tight` 、number and array|string\|number\|array|`medium`|>=1.17.0| |style|Inline style|CSSProperties|-|>=1.17.0| |vertical|Set to vertical spacing|boolean|false|>=1.17.0| |wrap|Whether to wrap|boolean|false|>=1.17.0| ## Design Tokens