sheet

package
v1.0.31-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 15 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

This section is empty.

Functions

This section is empty.

Types

type Detent

type Detent int

Detent is a height a bottom sheet can rest at.

const (
	// DetentFit sizes the sheet to its content, up to nearly the full
	// window (the default).
	DetentFit Detent = iota
	// DetentMedium is half the window.
	DetentMedium
	// DetentLarge is nearly the full window.
	DetentLarge
)

type Sheet

type Sheet struct {
	// contains filtered or unexported fields
}

Sheet is a modal panel over a dimmed scrim: a bottom sheet that slides up from the bottom edge, or with Adaptive a centered dialog on wide windows. It has an optional title, a scrolling body and a footer pinned below it. The scrim, Back and Escape close it, as does dragging its handle down; with several Detents, dragging moves it between them.

Like Drawer it takes no space in the layout and paints over the window while open, so it can sit anywhere in the tree. Create it once with New, outside the view function.

func New

func New(open *bool, content func() elements.Element, st ...styles.Styles) *Sheet

New returns a Sheet bound to open: it shows whenever *open is true. content builds the body fresh every frame the sheet is shown. The styles argument is optional and styles the panel: Background (default theme.surface), Padding (default 16 on the sides), Color.

func (*Sheet) Adaptive

func (s *Sheet) Adaptive(on bool) *Sheet

Adaptive shows the sheet as a centered dialog when the window is at least 600dp wide, and as a bottom sheet below that. It returns s for chaining.

func (*Sheet) Detents

func (s *Sheet) Detents(d ...Detent) *Sheet

Detents sets the heights a bottom sheet rests at, smallest first; it opens at the first. Dragging the handle moves between them, and below the first closes the sheet. It returns s for chaining.

func (*Sheet) Dismissible

func (s *Sheet) Dismissible(on bool) *Sheet

Dismissible controls whether the scrim, Back, Escape and dragging close the sheet (on by default). It returns s for chaining.

func (*Sheet) Footer

func (s *Sheet) Footer(f func() elements.Element) *Sheet

Footer sets content pinned below the scrolling body, such as action buttons. It returns s for chaining.

func (*Sheet) Layout

func (s *Sheet) Layout(gtx layout.Context) layout.Dimensions

Layout updates the sheet and, while it's visible, registers the overlay that paints it. It takes no space.

func (*Sheet) Opened

func (s *Sheet) Opened() bool

Opened reports whether the sheet is open.

func (*Sheet) OutOfFlow

func (s *Sheet) OutOfFlow()

OutOfFlow marks the sheet as taking no space in a Box, so the box's Gap leaves it out; see elements.OutOfFlow.

func (*Sheet) Styles

func (s *Sheet) Styles(st styles.Styles) *Sheet

Styles replaces the panel styles from the next frame. It returns s for chaining.

func (*Sheet) Title

func (s *Sheet) Title(t string) *Sheet

Title sets the heading shown above the body. It returns s for chaining.

Jump to

Keyboard shortcuts

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