Card
组合标题、说明和主体内容。
实时预览
正在加载预览…
参数配置
全部字段 7
CardOptions
Go 代码
Go
// Inside a view; c is *ui.Context, t is nui.Theme.
nui.Card(c.Key("card"), t, nui.CardOptions{Title: "Project overview", Description: "A native Go component", Variant: nui.VariantDefault}, func() {
ui.Text(c, "A focused space for related content.")
nui.Button(c.Key("action"), t, "Continue", nui.ButtonOptions{})
})使用说明
Card 将标题、说明和主体回调组合成一个区域。示例中的 Continue 按钮展示内容组合,尚未绑定业务操作;切换 Variant 比较卡片外观。
API 参考
Card
源码func Card(c *ui.Context, t Theme, opts CardOptions, body func()) ui.ElementCardOptions
源码type CardOptions struct {
Variant Variant
Title, Description string
Header, Footer func()
Decoration
}| 字段 | 类型 | 说明 |
|---|---|---|
Variant | VariantGo 零值: | 组件外观样式,支持范围取决于组件。 |
Title | stringGo 零值: | 标题文字。 |
Description | stringGo 零值: | 补充说明文字。 |
Header | func()Go 零值: | 同步构建标题区域。 |
Footer | func()Go 零值: | 同步构建底部区域。 |
UI | StylesGo 零值: | 以部件名称为键覆盖外观和间距。 |
Style | func(Slot, ui.Element)Go 零值: | 同步配置当前构建的部件;不要保留 Element。 |