# HeadingNode

<!-- schema:start — tự sinh từ heading.schema.ts, không sửa tay -->

Tiêu đề (h1-h6 hoặc div). Chứa text, hoặc các node con fragment, inline, link.

## Resolved name

`heading`

## Configurable props

### Props

| Prop | Giá trị | Responsive | Mô tả |
| --- | --- | --- | --- |
| `as` | `'h1' · 'h2' · 'h3' · 'h4' · 'h5' · 'h6' · 'div'` | không | Thẻ HTML của tiêu đề |
| `sizeVariant` | `'xs' · 'sm' · 'base' · 'lg' · 'xl' · '2xl' · '3xl' · '4xl' · '5xl' · '6xl'` | có | Cỡ chữ theo thang typography |

### `sx`

| Key | Giá trị | Breakpoint |
| --- | --- | --- |
| `color` | `color` | chỉ mobile (xs) |
| `fontWeight` | `200 · 300 · 400 · 500 · 600 · 700 · 800` | mọi breakpoint |
| `fontStyle` | `'italic'` | chỉ mobile (xs) |
| `textDecorationLine` | `'underline'` | chỉ mobile (xs) |
| `textTransform` | `'uppercase' · 'capitalize' · 'lowercase'` | chỉ mobile (xs) |
| `textAlign` | `'left' · 'center' · 'right' · 'justify'` | mọi breakpoint |
| `width` | `px · 'N%' · 'auto'` | mọi breakpoint |
| `marginTop` | `px · 'auto'` | mọi breakpoint |
| `marginRight` | `px · 'auto'` | mọi breakpoint |
| `marginBottom` | `px · 'auto'` | mọi breakpoint |
| `marginLeft` | `px · 'auto'` | mọi breakpoint |
| `paddingTop` | `px` | mọi breakpoint |
| `paddingRight` | `px` | mọi breakpoint |
| `paddingBottom` | `px` | mọi breakpoint |
| `paddingLeft` | `px` | mọi breakpoint |
| `backgroundColor` | `color` | mọi breakpoint |
| `backgroundImage` | `url(https://…)` | mọi breakpoint |
| `backgroundSize` | `'cover' · 'contain' · 'auto'` | mọi breakpoint |
| `backgroundPosition` | `'left top' · 'top' · 'right top' · 'left' · 'center' · 'right' · 'left bottom' · 'bottom' · 'right bottom'` | mọi breakpoint |
| `backgroundRepeat` | `'no-repeat' · 'repeat-x' · 'repeat-y' · 'repeat'` | mọi breakpoint |
| `backgroundAttachment` | `'scroll' · 'fixed' · 'local'` | mọi breakpoint |

`color` = `var(--color-{primary\|secondary\|red\|orange\|yellow\|green\|blue\|violet\|neutral}-{100..800\|contrast}) · var(--color-background-{subtle\|default\|emphasis}) · var(--color-border-default) · var(--color-surface-default) · var(--color-common-{black\|white}) · #rgb · #rrggbb`

## Rules

- **Nội dung**: chỉ nhận `fragment`, `inline`, `link`, hoặc văn bản thay cho node con.
- **Cha hợp lệ**: bất kỳ.

<!-- schema:end -->

## Behavior

- Render qua component `Text` của `@janbox/storefront-ui`.
- Double-click trên canvas để chỉnh nội dung trực tiếp.

## Usage

```tsx
import { HeadingNode } from '@janbox/storefront-builder';

// H1
<HeadingNode as="h1" sizeVariant="4xl">
  Page Title
</HeadingNode>

// Responsive size
<HeadingNode
  as="h2"
  sizeVariant="2xl"
  md={{ sizeVariant: '4xl' }}
  sx={{ color: '#111111', textAlign: 'center' }}
>
  Section Title
</HeadingNode>

// Dùng div khi không cần semantic heading nhưng muốn style heading
<HeadingNode as="div" sizeVariant="xl" sx={{ fontWeight: 700 }}>
  Display text
</HeadingNode>
```

## Related nodes

- [`ParagraphNode`](../paragraph/README.md) — dành cho nội dung dạng đoạn văn
