Use these components to build responsive layouts, navigation structures, and progressive disclosure without dropping down to custom templates.
paw.Containerpaw.Rowpaw.Panelpaw.Linkpaw.Navbarpaw.DialogAPI 接口 |
Description 说明 |
|---|---|
Container, Row, Panel |
Core layout primitives for page shells, cards, and responsive columns. 页面壳、卡片和响应式列布局的核心原语。 |
Link, Links, Link.Button(), Link.Primary(), Link.Success(), Link.Danger() |
Text links, button-style actions, and grouped action rows. 文本链接、按钮式动作以及成组动作按钮。 |
Navbar, NavTabs |
Top-level navigation and tabbed sub-navigation. 顶层导航与标签页式子导航。 |
Popover, Collapse |
Inline hints and expandable content. 行内提示和可展开内容。 |
Dialog, ConfirmLink |
Modal workflows and confirmation wrappers around link actions. 模态框工作流,以及围绕链接动作的确认封装。 |
Pagination |
Turns a base URL and item counts into page links. 根据基础 URL 和总条目数生成分页链接。 |
Most pages start with a container, then add rows and panels for the actual content.
body := paw.Container{
Body: paw.Row{
ColumnMax: 2,
Columns: paw.List{
paw.Panel{
Title: paw.String("Overview"),
Body: paw.String("Rows handle the responsive layout."),
},
paw.Panel{
Title: paw.String("Actions"),
Body: paw.Links{
{Name: "Save"}.Success(),
{Name: "Delete"}.Danger(),
},
},
},
},
}
Navigation and interaction patterns can stay in the same composition model as the rest of the page.
Collapse keeps secondary content nearby without turning it into a new page.
paw.Navbar{
Brand: paw.Link{Name: "Paw Docs", Url: "/"},
Links: []paw.Link{
{Name: "Core", Url: "/CorePrimitives"},
{Name: "Forms", Url: "/FormsBasic"},
},
}
paw.Link{Url: template.URL("tel:+123456789"), Icon: "telephone-forward"}
paw.Collapse{
Trigger: paw.Link{Name: "Show details"}.Button().Primary(),
Body: paw.String("Collapsed content"),
}
Link.Url accepts string or template.URL. Reserve template.URL for trusted values such as tel:, custom schemes, or deliberate javascript: hooks.
ConfirmLink is implemented with Dialog under the hood, so it is best for short confirmation flows instead of large forms.
Pagination preserves the existing query string and only rewrites the page parameter.