Table handles the standard structure, while Td lets you override individual cells for color or colspan.
paw.Tablepaw.Tdpaw.StringNoWrappaw.SmallAPI 接口 |
Description 说明 |
|---|---|
Table |
Renders a table from a header row and a body of Ui cells. 根据表头和 Ui 单元格内容渲染表格。 |
Td |
Overrides a single cell when you need colspan or contextual color. 当你需要 colspan 或上下文颜色时,用它覆盖单个单元格。 |
Most table cells can stay as normal Paw UI values. Table wraps them into td elements automatically.
| Action | Status | Notes |
|---|---|---|
| Open | Open | StringNoWrap keeps short identifiers on one line. |
| Archive | Closed | Longer notes can still use Pre when you want preserved whitespace. |
paw.Table{
AlignCenter: true,
Head: paw.List{
paw.String("Action"),
paw.String("Status"),
paw.String("Notes"),
},
Body: [][]paw.Ui{
{
paw.Link{Name: "Open"}.Button().Primary(),
paw.Badge{Text: "Open", Color: paw.ColorPrimary},
paw.StringNoWrap("StringNoWrap keeps identifiers together."),
},
},
}
Use Td when you need contextual colors or a colspan cell in the middle of a row.
| Queued | colspan=2 alert area | |
| worker-a | worker-b | worker-c |
| Primary summary | Healthy | |
| Name | Index | Icon |
|---|---|---|
| Tommy | 0 | 🐶 |
| Jacky | 1 | 🐱 |
paw.Td{
Color: paw.ColorDanger,
ColSpan: 2,
Body: paw.String("colspan=2 alert area"),
}
Table wraps non-Td cells for you, so only reach for Td when you need extra control over a specific cell.
StringNoWrap and Small pair well with tables when space is tight.