EdgeButtonKt
public final class EdgeButtonKt
Summary
Public methods |
|
|---|---|
static final @NonNull LayoutElementBuilders.LayoutElement |
iconEdgeButton(ProtoLayout Material3 component edge button that offers a single slot to take an icon or similar round, small content. |
static final @NonNull LayoutElementBuilders.LayoutElement |
textEdgeButton(ProtoLayout Material3 component edge button that offers a single slot to take a text or similar long and wide content. |
Public methods
iconEdgeButton
public static final @NonNull LayoutElementBuilders.LayoutElement iconEdgeButton(
@NonNull MaterialScope receiver,
@NonNull ModifiersBuilders.Clickable onClick,
@NonNull LayoutModifier modifier,
@NonNull ButtonColors colors,
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> iconContent
)
ProtoLayout Material3 component edge button that offers a single slot to take an icon or similar round, small content.
The edge button is intended to be used at the bottom of a round screen. It has a special shape with its bottom almost follows the screen's curvature. It has fixed height, and takes 1 line of icon. This button represents the most important action on the screen, and it must occupy the whole horizontal space in its position as well as being anchored to the screen bottom.
This component is not intended to be used with an image background.
The button's colors default to using ColorScheme from the MaterialScope it's defined in, which defaults to dynamicColorScheme, meaning that the colors follow system theme if available on device. If not, or switched off by user, uses fallback ColorScheme defined in its MaterialScope.
See common-layouts/tiles and bestpractices for more visuals and design recommendations.
import androidx.wear.protolayout.material3.button import androidx.wear.protolayout.material3.icon import androidx.wear.protolayout.material3.iconEdgeButton import androidx.wear.protolayout.material3.materialScope import androidx.wear.protolayout.material3.text import androidx.wear.protolayout.modifiers.LayoutModifier import androidx.wear.protolayout.modifiers.clickable import androidx.wear.protolayout.modifiers.contentDescription materialScope(context, deviceConfiguration) { iconEdgeButton( onClick = clickable, modifier = LayoutModifier.contentDescription("Description of a button"), ) { icon(protoLayoutResourceId = "id") } }
| Parameters | |
|---|---|
@NonNull ModifiersBuilders.Clickable onClick |
Associated |
@NonNull LayoutModifier modifier |
Modifiers to set to this element. It's highly recommended to set a content description using |
@NonNull ButtonColors colors |
The colors used for this button. If not set, |
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> iconContent |
The icon slot for content displayed in this button. It is recommended to use default styling that is automatically provided by only calling |
textEdgeButton
public static final @NonNull LayoutElementBuilders.LayoutElement textEdgeButton(
@NonNull MaterialScope receiver,
@NonNull ModifiersBuilders.Clickable onClick,
@NonNull LayoutModifier modifier,
@NonNull ButtonColors colors,
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> labelContent
)
ProtoLayout Material3 component edge button that offers a single slot to take a text or similar long and wide content.
The edge button is intended to be used at the bottom of a round screen. It has a special shape with its bottom almost follows the screen's curvature. It has fixed height, and takes 1 line of text. This button represents the most important action on the screen, and it must occupy the whole horizontal space in its position as well as being anchored to the screen bottom.
This component is not intended to be used with an image background.
The button's colors default to using ColorScheme from the MaterialScope it's defined in, which defaults to dynamicColorScheme, meaning that the colors follow system theme if available on device. If not, or switched off by user, uses fallback ColorScheme defined in its MaterialScope.
See common-layouts/tiles and bestpractices for more visuals and design recommendations.
import androidx.wear.protolayout.material3.button import androidx.wear.protolayout.material3.materialScope import androidx.wear.protolayout.material3.text import androidx.wear.protolayout.material3.textEdgeButton import androidx.wear.protolayout.modifiers.LayoutModifier import androidx.wear.protolayout.modifiers.clickable import androidx.wear.protolayout.modifiers.contentDescription import androidx.wear.protolayout.types.layoutString materialScope(context, deviceConfiguration) { textEdgeButton( onClick = clickable, modifier = LayoutModifier.contentDescription("Description of a button"), ) { text("Hello".layoutString) } }
| Parameters | |
|---|---|
@NonNull ModifiersBuilders.Clickable onClick |
Associated |
@NonNull LayoutModifier modifier |
Modifiers to set to this element. It's highly recommended to set a content description using |
@NonNull ButtonColors colors |
The colors used for this button. If not set, |
@NonNull Function1<@NonNull MaterialScope, @NonNull LayoutElementBuilders.LayoutElement> labelContent |
The label slot for content displayed in this button. It is recommended to use default styling that is automatically provided by only calling |