Files
yoga/website/docs/styling/gap.mdx
Nick Gerleman 3c7ac064ad Yoga Docs: Label All JS/TS examples as JavaScript (#1620)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1620

A couple of these are labeled as TypeScript. We expose TypeScript types, but this also works as plain-old JavaScript, and is the label we use in most of the documentaion.

Reviewed By: joevilches

Differential Revision: D54884484

fbshipit-source-id: 763c56843a797db0a4f78776c55397eaa9b4a966
2024-03-14 11:10:50 -07:00

50 lines
1.2 KiB
Plaintext

---
sidebar_position: 8
---
import Playground from '@site/src/components/Playground';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Gap
Gap will add spacing between the rows and columns of a flex container. You can
specify if you want the gaps to be between only the rows, only the columns, or
both. You can do this by passing in the corresponding gutter value to the API,
for example
<Tabs groupId="language">
<TabItem value="cpp" label="C/C++">
```cpp
YGNodeStyleSetGap(node, YGGutterRow, amount);
```
</TabItem>
<TabItem value="java" label="Java">
```java
node.setGap(YogaGutter.ROW, amount);
```
</TabItem>
<TabItem value="js" label="JavaScript">
```typescript
node.setGap(Gutter.Row, amount);
```
</TabItem>
</Tabs>
<Playground code={`<Layout config={{useWebDefaults: false}}>
<Node
style={{
width: 200,
height: 250,
padding: 10,
flexWrap: 'wrap',
gap: 10,
}}>
<Node style={{height: 50, width: 50}} />
<Node style={{height: 50, width: 50}} />
<Node style={{height: 50, width: 50}} />
<Node style={{height: 50, width: 50}} />
<Node style={{height: 50, width: 50}} />
</Node>
</Layout>`} />