mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Both old names are owned by a different npm account (artemis-prime), so publishing them returns 403 — which is how this surfaced: the 8.0.0 run shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a version that cannot be published and therefore does not exist. Those two were uninstallable. @hanzo/gui and @hanzogui/* are ours, so the framework now carries the name it is imported by everywhere downstream, and the loader moves under the scope we control. The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')` is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting either would change behaviour, so both are untouched. Co-authored-by: Hanzo Dev <[email protected]>
111 lines
2.3 KiB
Plaintext
111 lines
2.3 KiB
Plaintext
---
|
|
title: Stacks
|
|
description: An optional base for creating flex-based layouts.
|
|
name: stacks
|
|
component: Stacks
|
|
package: stacks
|
|
demoName: Stacks
|
|
---
|
|
|
|
<HeroContainer>
|
|
<StacksDemo />
|
|
</HeroContainer>
|
|
|
|
```tsx hero template=Stacks
|
|
|
|
```
|
|
|
|
<Highlights
|
|
features={[
|
|
'X, Y, and Z stacks for easy flex layouts.',
|
|
'Gap property to add space between elements.',
|
|
'Handle press, focus, and layout events easily.',
|
|
]}
|
|
/>
|
|
|
|
Gui UI includes optional stack views - XStack, YStack and ZStack. They extend directly off the [View](/docs/core/view-and-text) from `@hanzogui/core`.
|
|
|
|
Stack props accept [every prop from react-native-web](https://necolas.github.io/react-native-web/docs/view/) View, as well as all [the style properties Gui supports](/docs/intro/props).
|
|
|
|
In this example you'd show three `YStack` elements spaced out.
|
|
|
|
## Installation
|
|
|
|
Stacks is already installed in `hanzogui`, or you can install it independently:
|
|
|
|
```bash
|
|
npm install @hanzogui/stacks
|
|
```
|
|
|
|
```tsx
|
|
import { XStack, YStack } from '@hanzo/gui'
|
|
|
|
export default () => (
|
|
<XStack gap="$2">
|
|
<YStack />
|
|
<YStack />
|
|
<YStack />
|
|
</XStack>
|
|
)
|
|
```
|
|
|
|
To see all the style properties supported, see the [Props](/docs/intro/props) documentation.
|
|
|
|
### Fuller example
|
|
|
|
An example using a wide variety of style properties:
|
|
|
|
```tsx
|
|
import { Text, XStack, YStack } from '@hanzo/gui'
|
|
|
|
export default () => (
|
|
<XStack
|
|
flex={1}
|
|
flexWrap="wrap"
|
|
backgroundColor="#fff"
|
|
hoverStyle={{
|
|
backgroundColor: 'red',
|
|
}}
|
|
// media query
|
|
$gtSm={{
|
|
flexDirection: 'column',
|
|
flexWrap: 'nowrap',
|
|
}}
|
|
>
|
|
<YStack gap="$3">
|
|
<Text>Hello</Text>
|
|
<Text>World</Text>
|
|
</YStack>
|
|
</XStack>
|
|
)
|
|
```
|
|
|
|
## API Reference
|
|
|
|
### XStack, YStack, ZStack
|
|
|
|
Beyond the [Gui Props](/docs/intro/props), the stacks add just two variants:
|
|
|
|
<PropsTable
|
|
data={[
|
|
{
|
|
name: 'fullscreen',
|
|
required: false,
|
|
type: 'boolean',
|
|
description: (
|
|
<span>Sets position: absolute, top: 0, left: 0, right: 0, bottom: 0.</span>
|
|
),
|
|
},
|
|
{
|
|
name: 'elevation',
|
|
required: false,
|
|
type: 'number | tokens.size',
|
|
description: (
|
|
<span>
|
|
Sets a natural looking shadow that expands out and away as the size gets bigger.
|
|
</span>
|
|
),
|
|
},
|
|
]}
|
|
/>
|