docs

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.")},
}
View Source
var BadgeFixtures = gx.Fixtures[BadgeProps]{
	"Default":     {Label: "Default"},
	"Secondary":   {Label: "Secondary", Variant: BadgeSecondary},
	"Destructive": {Label: "Destructive", Variant: BadgeDestructive},
	"Outline":     {Label: "Outline", Variant: BadgeOutline},
}
View Source
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"},
}
View Source
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.")}),
	)},
}
View Source
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.

View Source
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"},
	}},
}
View Source
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"},
	}}},
}
View Source
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"},
}
View Source
var IconFixtures = gx.Fixtures[IconProps]{
	"Decorative": {Body: gx.SafeHTML(`<path d="M4 12h16" />`)},
	"Labelled":   {Body: gx.SafeHTML(`<path d="M4 12h16" />`), Label: "A dash"},
}
View Source
var LLMSkipFixtures = gx.Fixtures[LLMSkipProps]{
	"Default": {Children: gx.Text("Only for the page.")},
}
View Source
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")},
}
View Source
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"},
}
View Source
var StepsFixtures = gx.Fixtures[StepsProps]{
	"Three": {Children: gx.Raw(gx.SafeHTML(`<ol><li>First</li><li>Second</li><li>Third</li></ol>`))},
}
View Source
var TabItemFixtures = gx.Fixtures[TabItemProps]{
	"Text": {Label: "Tab", Children: gx.Text("Panel body.")},
}
View Source
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 Card

func Card(p CardProps) gx.Node

func CardGrid

func CardGrid(p CardGridProps) gx.Node

func Code

func Code(p CodeProps) gx.Node

func FileTree

func FileTree(p FileTreeProps) gx.Node

func FileTreeItemRow

func FileTreeItemRow(p FileTreeItemRowProps) gx.Node

func Hero

func Hero(p HeroProps) gx.Node

func Icon

func Icon(p IconProps) gx.Node

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

func Tabs

func Tabs(p TabsProps) 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
	// 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"
)

The variants of docs.LinkButton.

type CardGridProps

type CardGridProps struct {
	// Children is the cards of the grid.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type CardProps

type CardProps struct {
	// Title is the heading of the card. Empty omits it.
	Title string
	// 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 IconProps

type IconProps struct {
	// Body is the inner markup of the svg, from a pinned icon pack.
	Body gx.SafeHTML
	// Label is the accessible name of the icon.
	// Empty hides the icon from assistive technology.
	Label string
	// Class adds classes to the root element.
	Class string
}

type Kind

type Kind string

Kind is the tone of a docs callout (REQ-CNT-05).

const (
	Note    Kind = "note"
	Tip     Kind = "tip"
	Caution Kind = "caution"
	Danger  Kind = "danger"
)

The tones of docs.Aside.

type LLMSkipProps

type LLMSkipProps struct {
	// Children is the content of the block. The component renders nothing; the block marks
	// Markdown that stays out of llms.txt.
	Children gx.Node
}

type LinkButtonProps

type LinkButtonProps struct {
	// Href is the link target.
	Href gx.URL
	// Variant sets the visual style: ButtonPrimary, ButtonSecondary, ButtonOutline or
	// ButtonGhost.
	Variant ButtonVariant
	// 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 StepsProps struct {
	// Children is the ordered list of steps.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type TabItemProps

type TabItemProps struct {
	// Label is the text of the tab button. It must be unique inside one tab group.
	Label string
	// Children is the content of the tab panel.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL