tabs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tabs provides tab components following shadcn/ui patterns. Tabs use Alpine.js for state management and support keyboard navigation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tab

func Tab(id string, label g.Node) g.Node

Tab creates an individual tab button

Example:

tabs.Tab("overview", g.Text("Overview"))

func TabList

func TabList(children ...g.Node) g.Node

TabList creates a wrapper for tab buttons

Example:

tabs.TabList(
    tabs.Tab("tab1", g.Text("Tab 1")),
    tabs.Tab("tab2", g.Text("Tab 2")),
)

func TabPanel

func TabPanel(id string, content ...g.Node) g.Node

TabPanel creates a content panel for a tab

Example:

tabs.TabPanel("overview", g.Text("Overview content here"))

func Tabs

func Tabs(children ...g.Node) g.Node

Tabs creates a tabs container with Alpine.js state management

Example:

tabs.Tabs(
    tabs.WithDefaultTab("overview"),
    tabs.TabList(
        tabs.Tab("overview", g.Text("Overview")),
        tabs.Tab("details", g.Text("Details")),
    ),
    tabs.TabPanel("overview", g.Text("Overview content")),
    tabs.TabPanel("details", g.Text("Details content")),
)

func TabsWithOptions

func TabsWithOptions(opts []Option, children ...g.Node) g.Node

TabsWithOptions creates tabs with custom options

Types

type Option

type Option func(*TabsProps)

Option is a functional option for configuring tabs

func WithAttrs

func WithAttrs(attrs ...g.Node) Option

WithAttrs adds custom attributes

func WithClass

func WithClass(class string) Option

WithClass adds custom classes

func WithDefaultTab

func WithDefaultTab(id string) Option

WithDefaultTab sets the initially active tab

func WithOrientation

func WithOrientation(o Orientation) Option

WithOrientation sets the tab orientation

type Orientation

type Orientation string

Orientation defines tab layout direction

const (
	OrientationHorizontal Orientation = "horizontal"
	OrientationVertical   Orientation = "vertical"
)

type TabsProps

type TabsProps struct {
	DefaultTab  string
	Orientation Orientation
	Class       string
	Attrs       []g.Node
}

TabsProps defines tabs configuration

Jump to

Keyboard shortcuts

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