carousel

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 1 Imported by: ? modules, 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

Overview

Package carousel is a row of slides in a scroll container with CSS scroll snap. The CarouselControls island adds the previous and next buttons.

Index

Constants

This section is empty.

Variables

View Source
var CarouselFixtures = gx.Fixtures[CarouselProps]{
	"Default":  {Id: "carousel-default", Label: "Numbers", Children: gx.Frag(slide("1"), slide("2"), slide("3"))},
	"Vertical": {Id: "carousel-vertical", Label: "Numbers", Orientation: Vertical, Children: gx.Frag(slide("1"), slide("2"), slide("3"))},
}
View Source
var CarouselItemFixtures = gx.Fixtures[CarouselItemProps]{
	"Default": {Children: gx.El("div", gx.Attrs{{Key: "class", Value: "flex h-40 items-center justify-center rounded-md border border-border bg-card text-4xl font-semibold text-card-foreground"}}, gx.Text("1"))},
}

Functions

func Carousel(p CarouselProps) gx.Node

func CarouselControls

func CarouselControls(p CarouselControlsProps, opts ...gx.IslandOption) gx.Node

CarouselControls renders the island of CarouselControls.ts (REQ-ISL-01). The browser mounts it with the props as JSON. An option sets the time of the load.

func CarouselItem

func CarouselItem(p CarouselItemProps) gx.Node

Types

type CarouselControlsProps

type CarouselControlsProps struct {
	// Viewport is the id of the scroll container.
	Viewport string `json:"viewport"`
	// Orientation is "horizontal" or "vertical".
	Orientation string `json:"orientation"`
	// PreviousLabel and NextLabel name the two buttons.
	PreviousLabel string `json:"previousLabel"`
	NextLabel     string `json:"nextLabel"`
	// StatusText is the text of the position, with {n} and {count}.
	StatusText string `json:"statusText"`
	// Classes holds the classes of the parts. They are Go constants, so
	// the stylesheet build sees them.
	Classes ControlClasses `json:"classes"`
}

CarouselControlsProps are the props of the island that draws the buttons. The island scrolls the element with the id Viewport.

type CarouselItemProps

type CarouselItemProps struct {
	// Class adds classes to the root element.
	Class string
	// Children is the content of the slide.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type CarouselProps

type CarouselProps struct {
	// Id is the id of the root element.
	Id string
	// Label is the accessible name of the carousel.
	Label string
	// Orientation sets the direction of the slides: Horizontal or Vertical.
	Orientation Orientation
	// Class adds classes to the root element.
	Class string
	// Children are the slides: one CarouselItem for each.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type ControlClasses

type ControlClasses struct {
	Root   string `json:"root"`
	Button string `json:"button"`
	Status string `json:"status"`
}

ControlClasses are the classes of the parts that the island draws.

type Orientation

type Orientation string

Orientation is the direction of the slides of a carousel.

const (
	Horizontal Orientation = "horizontal"
	Vertical   Orientation = "vertical"
)

The orientations of carousel.Carousel.

Jump to

Keyboard shortcuts

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