androidx.compose.foundation.shape

CornerBasedShape

Abstract class · from org.jetbrains.compose.foundation:foundation:1.12.2

A Shape made of four corners, each with its own CornerSize.

You rarely write this name. You create a RoundedCornerShape or CutCornerShape instead. You see it in the theme: every value in Shapes is a CornerBasedShape.

Use copy() to change some corners of an existing shape:

MaterialTheme.shapes.large.copy(bottomStart = CornerSize(0.dp), bottomEnd = CornerSize(0.dp))
abstract class CornerBasedShape(
    topStart: CornerSize,
    topEnd: CornerSize,
    bottomEnd: CornerSize,
    bottomStart: CornerSize,
) : Shape, Interpolatable

Is a

Kinds of CornerBasedShape

Anywhere a CornerBasedShape is expected, you can pass any of these.

How to get one

Ready-made values and functions that return it

Used by

Parameters that take a CornerBasedShape.

Properties

topStart

val topStart: CornerSize

topEnd

val topEnd: CornerSize

bottomEnd

val bottomEnd: CornerSize

bottomStart

val bottomStart: CornerSize

Functions

createOutline

fun createOutline(
    size: Size,
    topStart: Float,
    topEnd: Float,
    bottomEnd: Float,
    bottomStart: Float,
    layoutDirection: LayoutDirection,
): Outline

Creates Outline of this shape for the given size.

copy

fun copy(
    topStart: CornerSize = this.topStart,
    topEnd: CornerSize = this.topEnd,
    bottomEnd: CornerSize = this.bottomEnd,
    bottomStart: CornerSize = this.bottomStart,
): CornerBasedShape

Creates a copy of this Shape with a new corner sizes.

fun copy(all: CornerSize): CornerBasedShape

Creates a copy of this Shape with a new corner size.