# InlineNode

Phần văn bản có kiểu riêng trong rich text (đậm, nghiêng, đổi màu, đổi cỡ chữ...). Nằm bên trong `ParagraphNode`, `HeadingNode` hoặc `LinkNode`, xen kẽ với `FragmentNode`.

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

Đoạn text có kiểu riêng (cỡ chữ, màu, đậm, nghiêng...) nằm trong heading, paragraph hoặc link.

## Resolved name

`inline`

## Configurable props

### Props

| Prop | Giá trị | Responsive | Mô tả |
| --- | --- | --- | --- |
| `as` | `'span' · 'strong' · 'em' · 'b' · 'i' · 'u' · 'small' · 'mark' · 'sub' · 'sup' · 'code'` | không | Thẻ HTML của đoạn inline |
| `textVariable` | `object` | không | Biến text của consumer, hiển thị thay cho text |
| `textVariable.key` | `chuỗi` | không |  |

### `sx`

| Key | Giá trị | Breakpoint |
| --- | --- | --- |
| `color` | `color` | chỉ mobile (xs) |
| `fontWeight` | `200 · 300 · 400 · 500 · 600 · 700 · 800` | chỉ mobile (xs) |
| `fontStyle` | `'italic'` | chỉ mobile (xs) |
| `textDecorationLine` | `'underline'` | chỉ mobile (xs) |
| `textTransform` | `'uppercase' · 'capitalize' · 'lowercase'` | chỉ mobile (xs) |
| `textAlign` | `'left' · 'center' · 'right' · 'justify'` | chỉ mobile (xs) |
| `fontSize` | `px` | chỉ mobile (xs) |

`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**: văn bản, không chứa node con.
- **Cha hợp lệ**: `heading`, `paragraph`, `link`.
- props.textVariable.key phải là một key có trong textVariables của consumer.

<!-- schema:end -->

## Usage

```tsx
import { ParagraphNode, FragmentNode, InlineNode } from '@janbox/storefront-builder';

// Rich text: văn bản thường xen kẽ đoạn có kiểu riêng
<ParagraphNode>
  <FragmentNode>Giảm </FragmentNode>
  <InlineNode sx={{ fontWeight: 700 }}>50%</InlineNode>
</ParagraphNode>

// Biến text: hiển thị `resources.textVariables.name` của Composer, thiếu giá trị thì hiện `{{name}}`
<Composer resources={{ textVariables: { name: 'Ann' } }}>
  …
  <ParagraphNode>
    <FragmentNode>Xin chào </FragmentNode>
    <InlineNode textVariable={{ key: 'name' }} />
  </ParagraphNode>
</Composer>
```

## Notes

- Không có inspector nào ghi `as` hay `textVariable`: hai prop này do code hoặc template đặt.
- `textVariable.key` là một key trong `textVariables` mà consumer cấp qua prop `resources` của `Composer` / `Editor`; node hiển thị giá trị của biến thay cho text, thiếu giá trị thì hiện `{{key}}`. Copilot chỉ được ghi key có trong `textVariables`.
