androidx.ui.material.surface

Top-level functions summary

Unit
Card(modifier: Modifier = Modifier.None, shape: Shape = (+MaterialTheme.shapes()).card, color: Color = (+MaterialTheme.colors()).surface, border: Border? = null, elevation: Dp = 1.dp, children: () -> Unit)

Cards are Surfaces that display content and actions on a single topic.

Unit
Surface(modifier: Modifier = Modifier.None, shape: Shape = RectangleShape, color: Color = (+MaterialTheme.colors()).surface, border: Border? = null, elevation: Dp = 0.dp, children: () -> Unit)

The Surface is responsible for:

Top-level properties summary

Ambient<Color>

An ambient to store the current background.

Top-level functions

Card

@Composable fun Card(
    modifier: Modifier = Modifier.None,
    shape: Shape = (+MaterialTheme.shapes()).card,
    color: Color = (+MaterialTheme.colors()).surface,
    border: Border? = null,
    elevation: Dp = 1.dp,
    children: () -> Unit
): Unit

Cards are Surfaces that display content and actions on a single topic.

Parameters
modifier: Modifier = Modifier.None Modifier to be applied to the layout of the card.
shape: Shape = (+MaterialTheme.shapes()).card Defines the surface's shape as well its shadow. A shadow is only displayed if the elevation is greater than zero.
color: Color = (+MaterialTheme.colors()).surface The background color.
border: Border? = null Optional border to draw on top of the shape.
elevation: Dp = 1.dp The z-coordinate at which to place this surface. This controls the size of the shadow below the surface.

Surface

@Composable fun Surface(
    modifier: Modifier = Modifier.None,
    shape: Shape = RectangleShape,
    color: Color = (+MaterialTheme.colors()).surface,
    border: Border? = null,
    elevation: Dp = 0.dp,
    children: () -> Unit
): Unit

The Surface is responsible for:

  1. Clipping: Surface clips its children to the shape specified by shape
  2. Elevation: Surface elevates its children on the Z axis by elevation pixels, and draws the appropriate shadow.
  3. Borders: If shape has a border, then it will also be drawn.

Material surface is the central metaphor in material design. Each surface exists at a given elevation, which influences how that piece of surface visually relates to other surfaces and how that surface casts shadows.

The text color for inner Text components will try to match the correlated color for the background color. For example, on ColorPalette.surface background ColorPalette.onSurface will be used for text. To modify these default style values use CurrentTextStyleProvider or provide direct styling to your components.

Parameters
modifier: Modifier = Modifier.None Modifier to be applied to the layout corresponding to the surface
shape: Shape = RectangleShape Defines the surface's shape as well its shadow. A shadow is only displayed if the elevation is greater than zero.
color: Color = (+MaterialTheme.colors()).surface The background color. Use Color.Transparent to have no color.
border: Border? = null Optional border to draw on top of the shape.
elevation: Dp = 0.dp The z-coordinate at which to place this surface. This controls the size of the shadow below the surface.

Top-level properties

CurrentBackground

val CurrentBackground: Ambient<Color>

An ambient to store the current background. Usually provided by Surface component.

Other components can read it to apply some logic to automatically change icons, text or Ripple color based on the current background.