badge

package
v0.1.122 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package badge contains Material 3 Badge components.

Reference: [Badges](https://m3.material.io/components/badges/overview) Specs: [Badges Specs](https://m3.material.io/components/badges/specs)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Badge

func Badge(options ...BadgeOption) api.Composable

Badge is a Material 3 badge component.

func BadgedBox

func BadgedBox(
	badge api.Composable,
	content api.Composable,
	modifiers ...ui.Modifier,
) api.Composable

BadgedBox is a layout that places a badge at the top-end corner of the content.

Types

type BadgeOption

type BadgeOption func(*BadgeOptions)

func WithContainerColor

func WithContainerColor(c graphics.Color) BadgeOption

func WithContent

func WithContent(content api.Composable) BadgeOption

WithContent sets custom composable content for the badge. For simple text badges, use WithText instead. The badge will apply the appropriate content color automatically.

func WithContentColor

func WithContentColor(c graphics.Color) BadgeOption

func WithModifier

func WithModifier(m ui.Modifier) BadgeOption

func WithText

func WithText(label string) BadgeOption

WithText is a convenience function to create a badge with text content. The text will use TypestyleLabelSmall and the badge's content color.

type BadgeOptions

type BadgeOptions struct {
	Content        api.Composable
	ContainerColor graphics.Color
	ContentColor   graphics.Color
	Modifier       ui.Modifier
}

func DefaultBadgeOptions

func DefaultBadgeOptions() BadgeOptions

type Composable

type Composable = api.Composable

type Composer

type Composer = api.Composer

Jump to

Keyboard shortcuts

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