Documentation
¶
Index ¶
- Variables
- func Aside(p AsideProps) gx.Node
- func Badge(p BadgeProps) gx.Node
- func Card(p CardProps) gx.Node
- func CardGrid(p CardGridProps) gx.Node
- func Code(p CodeProps) gx.Node
- func FileTree(p FileTreeProps) gx.Node
- func FileTreeItemRow(p FileTreeItemRowProps) gx.Node
- func Hero(p HeroProps) gx.Node
- func Icon(p IconProps) gx.Node
- func IconBody(name IconName) gx.SafeHTML
- func LLMSkip(p LLMSkipProps) gx.Node
- func LinkButton(p LinkButtonProps) gx.Node
- func LinkCard(p LinkCardProps) gx.Node
- func Steps(p StepsProps) gx.Node
- func TabItem(p TabItemProps) gx.Node
- func Tabs(p TabsProps) gx.Node
- type AsideProps
- type BadgeProps
- type BadgeVariant
- type ButtonVariant
- type CardGridProps
- type CardProps
- type CodeProps
- type FileTreeItem
- type FileTreeItemRowProps
- type FileTreeProps
- type HeroProps
- type IconName
- type IconProps
- type Kind
- type LLMSkipProps
- type LinkButtonProps
- type LinkCardProps
- type StepsProps
- type TabItemProps
- type TabsProps
Constants ¶
This section is empty.
Variables ¶
var AsideFixtures = gx.Fixtures[AsideProps]{ "Note": {Kind: Note, Title: "Note", Children: gx.Text("A note.")}, "Tip": {Kind: Tip, Children: gx.Text("A tip.")}, "Caution": {Kind: Caution, Children: gx.Text("Careful.")}, "Danger": {Kind: Danger, Title: "Danger", Children: gx.Text("Stop.")}, "Icon": {Kind: Tip, Title: "Tip", Icon: "rocket", Children: gx.Text("A tip with an icon.")}, }
var BadgeFixtures = gx.Fixtures[BadgeProps]{ "Default": {Label: "Default"}, "Secondary": {Label: "Secondary", Variant: BadgeSecondary}, "Destructive": {Label: "Destructive", Variant: BadgeDestructive}, "Outline": {Label: "Outline", Variant: BadgeOutline}, }
var CardFixtures = gx.Fixtures[CardProps]{ "TitleAndBody": {Title: "Card", Description: "A short description.", Children: gx.Text("Body text.")}, "BodyOnly": {Children: gx.Text("Body only.")}, "TitleOnly": {Title: "Title only"}, "WithIcon": {Title: "Settings", Icon: "setting", Children: gx.Text("Body text.")}, }
var CardGridFixtures = gx.Fixtures[CardGridProps]{ "Two": {Children: gx.Frag( Card(CardProps{Title: "One", Children: gx.Text("First.")}), Card(CardProps{Title: "Two", Children: gx.Text("Second.")}), )}, }
var CodeFixtures = gx.Fixtures[CodeProps]{ "Go": {Code: gx.Code{File: "go.mod", Lang: "go", Source: "module app\n\ngo 1.25.0\n"}, Title: "go.mod"}, "Marked": {Code: gx.Code{File: "go.mod", Lang: "go", Source: "module app\n\ngo 1.25.0\n"}, Marks: []int{1}}, }
The fixtures show go.mod, a file every app has: the example code names it with gx.CodeFile.
var FileTreeFixtures = gx.Fixtures[FileTreeProps]{ "Tree": {Items: []FileTreeItem{ {Name: "app", Dir: true, Children: []FileTreeItem{ {Name: "main.go", Comment: "the app entry"}, {Name: "theme.css"}, }}, {Name: "go.mod"}, }}, }
var FileTreeItemRowFixtures = gx.Fixtures[FileTreeItemRowProps]{ "File": {Item: FileTreeItem{Name: "main.go", Comment: "entry"}}, "Dir": {Item: FileTreeItem{Name: "app", Dir: true, Children: []FileTreeItem{ {Name: "main.go"}, }}}, }
var HeroFixtures = gx.Fixtures[HeroProps]{ "Full": {Title: "Gx", Tagline: "Server-rendered Go web apps.", Actions: gx.Raw(gx.SafeHTML(`<a href="/start">Get started</a>`))}, "Title": {Title: "Title only"}, }
var IconFixtures = gx.Fixtures[IconProps]{ "Decorative": {Body: gx.SafeHTML(`<path d="M4 12h16" />`)}, "Labelled": {Body: gx.SafeHTML(`<path d="M4 12h16" />`), Label: "A dash"}, }
var LLMSkipFixtures = gx.Fixtures[LLMSkipProps]{ "Default": {Children: gx.Text("Only for the page.")}, }
var LinkButtonFixtures = gx.Fixtures[LinkButtonProps]{ "Primary": {Href: gx.URL("/start"), Children: gx.Text("Get started")}, "Secondary": {Href: gx.URL("/start"), Variant: ButtonSecondary, Children: gx.Text("Secondary")}, "Outline": {Href: gx.URL("/start"), Variant: ButtonOutline, Children: gx.Text("Outline")}, "Ghost": {Href: gx.URL("/start"), Variant: ButtonGhost, Children: gx.Text("Ghost")}, "Minimal": {Href: gx.URL("/start"), Variant: ButtonMinimal, Children: gx.Text("Minimal")}, "WithIcon": {Href: gx.URL("/start"), Icon: "right-arrow", Children: gx.Text("Get started")}, }
var LinkCardFixtures = gx.Fixtures[LinkCardProps]{ "Full": {Href: gx.URL("/errors/GX1000"), Title: "Diagnostics", Description: "Every code has a page.", Children: gx.Text("Read on.")}, "Short": {Href: gx.URL("/start"), Title: "Start"}, }
var StepsFixtures = gx.Fixtures[StepsProps]{ "Three": {Children: gx.Raw(gx.SafeHTML(`<ol><li>First</li><li>Second</li><li>Third</li></ol>`))}, }
var TabItemFixtures = gx.Fixtures[TabItemProps]{ "Text": {Label: "Tab", Children: gx.Text("Panel body.")}, }
var TabsFixtures = gx.Fixtures[TabsProps]{ "Two": {Children: gx.Frag( TabItem(TabItemProps{Label: "Postgres", Children: gx.Text("Postgres body.")}), TabItem(TabItemProps{Label: "SQL Server", Children: gx.Text("SQL Server body.")}), )}, "Synced": {Sync: "db", Children: gx.Frag( TabItem(TabItemProps{Label: "Option A", Children: gx.Text("A.")}), TabItem(TabItemProps{Label: "Option B", Children: gx.Text("B.")}), )}, }
Functions ¶
func Aside ¶
func Aside(p AsideProps) gx.Node
func Badge ¶
func Badge(p BadgeProps) gx.Node
func CardGrid ¶
func CardGrid(p CardGridProps) gx.Node
func FileTree ¶
func FileTree(p FileTreeProps) gx.Node
func FileTreeItemRow ¶
func FileTreeItemRow(p FileTreeItemRowProps) gx.Node
func IconBody ¶ added in v0.4.0
IconBody returns the inner SVG markup of a built-in icon. An unknown name returns the empty string.
func LLMSkip ¶
func LLMSkip(p LLMSkipProps) gx.Node
func LinkButton ¶
func LinkButton(p LinkButtonProps) gx.Node
func LinkCard ¶
func LinkCard(p LinkCardProps) gx.Node
func Steps ¶
func Steps(p StepsProps) gx.Node
func TabItem ¶
func TabItem(p TabItemProps) gx.Node
Types ¶
type AsideProps ¶
type AsideProps struct {
// Kind sets the tone of the callout: Note, Tip, Caution or Danger.
Kind Kind
// Title is the heading of the callout. Empty omits it.
Title string
// Icon is the name of the built-in icon before the title. Empty omits it.
Icon IconName
// Children is the content of the callout.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type BadgeProps ¶
type BadgeProps struct {
// Label is the text of the badge.
Label string
// Variant sets the visual style: BadgeDefault, BadgeSecondary, BadgeDestructive or
// BadgeOutline.
Variant BadgeVariant
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type BadgeVariant ¶
type BadgeVariant string
BadgeVariant is the visual style of a docs badge (REQ-CNT-05).
const ( BadgeDefault BadgeVariant = "default" BadgeSecondary BadgeVariant = "secondary" BadgeDestructive BadgeVariant = "destructive" BadgeOutline BadgeVariant = "outline" )
The variants of docs.Badge.
type ButtonVariant ¶
type ButtonVariant string
ButtonVariant is the visual style of a docs link button (REQ-CNT-05).
const ( ButtonPrimary ButtonVariant = "primary" ButtonSecondary ButtonVariant = "secondary" ButtonOutline ButtonVariant = "outline" ButtonGhost ButtonVariant = "ghost" ButtonMinimal ButtonVariant = "minimal" )
The variants of docs.LinkButton.
type CardGridProps ¶
type CardProps ¶
type CardProps struct {
// Title is the heading of the card. Empty omits it.
Title string
// Icon is the name of the built-in icon before the title. Empty omits it.
Icon IconName
// Description is the text below the title. Empty omits it.
Description string
// Children is the content of the card. Nil omits the body.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type CodeProps ¶
type CodeProps struct {
// Code is the source to show. The compiler fills it at build time from a repository file.
Code gx.Code
// Title is the text in the frame bar.
Title string
// Wrap wraps long lines.
Wrap bool
// Marks holds the 1-based numbers of the lines to highlight.
Marks []int
// Ins holds the 1-based numbers of the lines to mark as inserted.
Ins []int
// Del holds the 1-based numbers of the lines to mark as deleted.
Del []int
// Words holds the 1-based numbers of the lines to outline.
Words []int
}
type FileTreeItem ¶
type FileTreeItem struct {
// Name is the shown base name.
Name string
// Dir marks a directory.
Dir bool
// Comment adds a short note after the name.
Comment string
// Children holds the directory entries.
Children []FileTreeItem
}
FileTreeItem is one file or directory of docs.FileTree (REQ-CNT-05).
type FileTreeItemRowProps ¶
type FileTreeItemRowProps struct {
// Item is the file or directory of the row. Its children show as a nested list.
Item FileTreeItem
}
type FileTreeProps ¶
type FileTreeProps struct {
// Items holds the top-level files and directories of the tree.
Items []FileTreeItem
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type HeroProps ¶
type HeroProps struct {
// Title is the heading of the hero.
Title string
// Tagline is the text below the title. Empty omits it.
Tagline string
// Actions is the row of links or buttons below the tagline. Nil omits it.
Actions gx.Node
// Children is the content below the actions. Nil omits it.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type IconName ¶ added in v0.4.0
type IconName string
IconName is the name of one built-in icon of the docs kit (REQ-CNT-05). The names and the drawings are the built-in icons of Starlight, without the file-type icons: Copyright (c) 2023 Astro contributors, MIT licence. A page that comes from `gx import starlight` keeps its icon names.
type LLMSkipProps ¶
type LinkButtonProps ¶
type LinkButtonProps struct {
// Href is the link target.
Href gx.URL
// Variant sets the visual style: ButtonPrimary, ButtonSecondary, ButtonOutline,
// ButtonGhost or ButtonMinimal.
Variant ButtonVariant
// Icon is the name of the built-in icon after the label. Empty omits it.
Icon IconName
// Children is the button label.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type LinkCardProps ¶
type LinkCardProps struct {
// Href is the link target.
Href gx.URL
// Title is the heading of the card.
Title string
// Description is the text below the title. Empty omits it.
Description string
// Children is the content below the description. Nil omits it.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
type StepsProps ¶
type TabItemProps ¶
type TabsProps ¶
type TabsProps struct {
// Sync is the key that links tab groups. Groups with the same key switch together and
// remember the chosen tab.
Sync string
// Default is the label of the tab that starts open. Empty opens the first tab.
Default string
// Children is the tab items.
Children gx.Node
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}
Source Files
¶
- Aside.fixtures.go
- Aside_gx.go
- Badge.fixtures.go
- Badge_gx.go
- Card.fixtures.go
- CardGrid.fixtures.go
- CardGrid_gx.go
- Card_gx.go
- Code.fixtures.go
- Code_gx.go
- FileTree.fixtures.go
- FileTreeItemRow.fixtures.go
- FileTreeItemRow_gx.go
- FileTree_gx.go
- Hero.fixtures.go
- Hero_gx.go
- Icon.fixtures.go
- Icon_gx.go
- LLMSkip.fixtures.go
- LLMSkip_gx.go
- LinkButton.fixtures.go
- LinkButton_gx.go
- LinkCard.fixtures.go
- LinkCard_gx.go
- Steps.fixtures.go
- Steps_gx.go
- TabItem.fixtures.go
- TabItem_gx.go
- Tabs.fixtures.go
- Tabs_gx.go
- aside.go
- badge.go
- filetree.go
- icons.go
- linkbutton.go