Files
zeekayandHanzo Dev 751ef5c778 rename the framework to @hanzo/gui and the loader to @hanzogui/loader
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]>
2026-07-30 20:23:18 -07:00

88 lines
2.4 KiB
Plaintext

---
title: Text
description: Text, Sized Text and Paragraph show one way to build a design system.
name: text
component: Paragraph
demoName: Text
---
# Text
<Description>
Text, Sized Text and Paragraph show one way to build a design system.
</Description>
<HeroContainer>
<TextDemo />
</HeroContainer>
```tsx hero template=Text
```
<Highlights
features={[
'Supports all react-native-web props and Gui styling props.',
'Media query styles, hoverStyle, pressStyle.',
'Paragraph uses themes and spread variants for a nicer default.',
]}
/>
### Usage
Text in Gui matches to Text in react-native-web, just with the added [Gui Props](/docs/intro/props).
It explicitly doesn't inherit your theme color or other font properties, as it's meant to be plain and used for extension. Below, we'll show `SizableText` which extends Text, and `Paragraph` which extends SizableText. Generally, Paragraph is the useful view as it will use theme values, while you can extend Text if you'd like to derive your own design system.
```tsx
import { Text, XStack, YStack } from '@hanzo/gui'
export default () => (
<>
<Text
// can add theme values
color="$white"
fontFamily="$body"
// or just use direct values
fontSize={20}
hoverStyle={{
color: '$color2',
}}
>
Lorem ipsum
</Text>
</>
)
```
<Notice>
SizableText and Paragraph default to the "body" fontFamily defined in your config.
Headings all default to "heading".
</Notice>
## SizableText
[Seeing how SizableText is defined](https://github.com/hanzoai/gui/blob/v2/pkgs/ui/text/src/SizableText.tsx) is helpful for understanding Gui. They serve as a good example of how you can extend and compose components.
SizableText simply adds a single `size` property to maniplulate all of:
- fontSize
- lineHeight
- fontWeight
- letterSpacing
Based on the values set in your tokens. It uses [spread variants](/docs/core/styled#spread-variants) feature. Then Paragraph extends that and ensures it defaults to values from your theme - fontSize, lineHeight, color and fontFamily.
## Paragraph
Finally Paragraph extends `SizableText` and simply sets some default values from your theme:
```tsx
export const Paragraph = styled(SizableText, {
fontFamily: '$body',
color: '$color',
// note hanzogui uses a generic "true" token that your sizes should set to be the same as the default on your scale
size: '$true',
})
```