Documentation
¶
Overview ¶
Package floatingactionbutton contains Material 3 Floating Action Button components.
Reference: [Floating Action Button](https://m3.material.io/components/floating-action-button/overview) Specs: [Floating Action Button Specs](https://m3.material.io/components/floating-action-button/specs)
Index ¶
- Variables
- func ElevationToDp(level token.ElevationLevel) unit.Dp
- func FloatingActionButton(onClick func(), content api.Composable, options ...FloatingActionButtonOption) api.Composable
- func GetSizeModifier(fabSize FabSize) modifier.Modifier
- func SurfaceWithThemeDefaults(fabClickable *widget.Clickable, elevation token.ElevationLevel, ...) api.Composable
- type FabSize
- type FloatingActionButtonOption
- func WithContainerColor(col graphics.Color) FloatingActionButtonOption
- func WithContentColor(col graphics.Color) FloatingActionButtonOption
- func WithElevation(elevation token.ElevationLevel) FloatingActionButtonOption
- func WithModifier(m modifier.Modifier) FloatingActionButtonOption
- func WithShape(shape shape.Shape) FloatingActionButtonOption
- func WithSize(size FabSize) FloatingActionButtonOption
- type FloatingActionButtonOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultFABElevation = token.ElevationLevel3
DefaultFABElevation is the default elevation for a FAB (Level 3).
Functions ¶
func ElevationToDp ¶
func ElevationToDp(level token.ElevationLevel) unit.Dp
ElevationToDp converts Material 3 elevation tokens to Dp values.
func FloatingActionButton ¶
func FloatingActionButton( onClick func(), content api.Composable, options ...FloatingActionButtonOption, ) api.Composable
FloatingActionButton is a Material 3 Floating Action Button. It sits above the content and represents the primary action.
func GetSizeModifier ¶
GetSizeModifier returns the size modifier for the FAB based on the FabSize option.
func SurfaceWithThemeDefaults ¶
func SurfaceWithThemeDefaults( fabClickable *widget.Clickable, elevation token.ElevationLevel, opts FloatingActionButtonOptions, fabModifier modifier.Modifier, content api.Composable, ) api.Composable
SurfaceWithThemeDefaults wraps Surface.
Types ¶
type FabSize ¶
type FabSize int
const ( // FabSizeMedium is the default 56dp FAB. // Available in both Original M3 and M3 Expressive. FabSizeMedium FabSize = iota // FabSizeSmall is the 40dp FAB. // Available in Original M3, but Deprecated in M3 Expressive (use a larger size). FabSizeSmall // FabSizeLarge is the 96dp FAB. // Available in both Original M3 and M3 Expressive. FabSizeLarge )
type FloatingActionButtonOption ¶
type FloatingActionButtonOption func(*FloatingActionButtonOptions)
func WithContainerColor ¶
func WithContainerColor(col graphics.Color) FloatingActionButtonOption
func WithContentColor ¶
func WithContentColor(col graphics.Color) FloatingActionButtonOption
func WithElevation ¶
func WithElevation(elevation token.ElevationLevel) FloatingActionButtonOption
WithElevation sets the base elevation.
func WithModifier ¶
func WithModifier(m modifier.Modifier) FloatingActionButtonOption
func WithShape ¶
func WithShape(shape shape.Shape) FloatingActionButtonOption
func WithSize ¶
func WithSize(size FabSize) FloatingActionButtonOption
type FloatingActionButtonOptions ¶
type FloatingActionButtonOptions struct {
ContainerColor graphics.Color
ContentColor graphics.Color
Elevation token.ElevationLevel
Modifier modifier.Modifier
Shape shape.Shape
Size FabSize
}
func DefaultFloatingActionButtonOptions ¶
func DefaultFloatingActionButtonOptions(c api.Composer) FloatingActionButtonOptions