androidx.compose.ui.graphics
Shape
Interface · from org.jetbrains.compose.ui:ui-graphics:1.12.2
An outline that a component uses for its background, border, shadow and clipping.
Shape is an interface. You don't implement it yourself in most apps. You pass one of the kinds below, or a ready-made value.
interface Shape
Kinds of Shape
Anywhere a Shape is expected, you can pass any of these.
DefaultTooltipCaretShapeCornerBasedShapefoundation — A shape made of four corners.AbsoluteCutCornerShapefoundationAbsoluteRoundedCornerShapefoundationCutCornerShapefoundationRoundedCornerShapefoundation — Rounded corners. The shape you create most often.
GenericShapefoundation
How to get one
The usual way is RoundedCornerShape(8.dp) or a value from the theme, like MaterialTheme.shapes.medium. See the Shapes guide.
Ready-made values and functions that return it
AlertDialogDefaults:shapeAssistChipDefaults:shapeBottomSheetDefaults:HiddenShape,ExpandedShapeButtonDefaults:squareShape,pressedShape,extraSmallPressedShape,mediumPressedShape,largePressedShape,extraLargePressedShape,shape,elevatedShape,filledTonalShape,outlinedShape,textShapeButtonGroupDefaults:connectedLeadingButtonShape,connectedLeadingButtonPressShape,connectedTrailingButtonShape,connectedTrailingButtonPressShape,connectedMiddleButtonPressShapeCardDefaults:shape,elevatedShape,outlinedShapeDatePickerDefaults:shapeDrawerDefaults:shapeFilterChipDefaults:shapeFloatingActionButtonDefaults:shape,smallShape,mediumShape,largeShape,extendedFabShape,smallExtendedFabShape,mediumExtendedFabShape,largeExtendedFabShapeFloatingToolbarDefaults:ContainerShapeGraphicsLayerScope:shapeIconButtonDefaults:standardShape,filledShape,outlinedShape,extraSmallRoundShape,extraSmallSquareShape,extraSmallPressedShape,extraSmallSelectedRoundShape,extraSmallSelectedSquareShape,smallRoundShape,smallSquareShape,smallPressedShape,smallSelectedRoundShape,smallSelectedSquareShape,mediumRoundShape,mediumSquareShape,mediumPressedShape,mediumSelectedRoundShape,mediumSelectedSquareShape,largeRoundShape,largeSquareShape,largePressedShape,largeSelectedRoundShape,largeSelectedSquareShape,extraLargeRoundShape,extraLargeSquareShape,extraLargePressedShape,extraLargeSelectedRoundShape,extraLargeSelectedSquareShapeInputChipDefaults:shapeListItemDefaults:shapeLoadingIndicatorDefaults:containerShapeMenuDefaults:leadingGroupShape,middleGroupShape,trailingGroupShape,leadingItemShape,middleItemShape,trailingItemShape,standaloneItemShape,selectedItemShape,standaloneGroupShape,inactiveGroupShapeOutlinedTextFieldDefaults:shape,roundedShapePullToRefreshDefaults:indicatorShapeScrollFieldDefaults:shapeSearchBarDefaults:inputFieldShape,fullScreenShape,dockedShape,dockedDropdownShapeSegmentedButtonDefaults:itemShape()SnackbarDefaults:shapeSuggestionChipDefaults:shapeTextFieldDefaults:shape,roundedShape
4 more
ToggleButtonDefaults:roundShape,squareShape,shape,pressedShape,checkedShape,extraSmallSquareShape,mediumSquareShape,largeSquareShape,extraLargeSquareShape,extraSmallPressedShape,mediumPressedShape,largePressedShape,extraLargePressedShape,extraSmallCheckedSquareShape,mediumCheckedSquareShape,largeCheckedSquareShape,extraLargeCheckedSquareShapeTooltipDefaults:plainTooltipContainerShape,richTooltipContainerShape,caretShape()WideNavigationRailDefaults:shape,modalCollapsedShape,modalExpandedShapetoShape()expRectangleShape
Or create one of the kinds listed above.
Used by
Parameters that take a Shape.
AlertDialog(shape)AppBarOverflowIndicator(shape)AppBarWithSearch(shape)AssistChip(shape)background(shape)border(shape)BottomSheet(shape)BottomSheetDefaults.DragHandle(shape)BottomSheetScaffold(sheetShape)Button(shape)ButtonGroupDefaults.OverflowIndicator(shape)Card(shape)ChipShapes.copy(shape, selectedShape, pressedShape)ContainedLoadingIndicator(containerShape)DatePickerDialog(shape)DismissibleDrawerSheet(drawerShape)DockedSearchBar(shape)DropdownMenu(shape)DropdownMenuItem(shape)ElevatedAssistChip(shape)ElevatedButton(shape)ElevatedCard(shape)ElevatedFilterChip(shape)ElevatedSuggestionChip(shape)ExpandedDockedSearchBar(shape)ExpandedDockedSearchBarWithGap(shape, dropdownShape)ExpandedFullScreenContainedSearchBar(collapsedShape)ExpandedFullScreenSearchBar(collapsedShape)ExposedDropdownMenuBoxScope.ExposedDropdownMenu(shape)ExtendedFloatingActionButton(shape)
83 more
FilledIconButton(shape)FilledIconToggleButton(shape)FilledTonalButton(shape)FilledTonalIconButton(shape)FilledTonalIconToggleButton(shape)FilterChip(shape)FloatingActionButton(shape)FloatingToolbarDefaults.StandardFloatingActionButton(shape)FloatingToolbarDefaults.VibrantFloatingActionButton(shape)HorizontalFloatingToolbar(shape)IconButton(shape)IconButtonShapes.copy(shape, pressedShape)IconToggleButton(shape)IconToggleButtonShapes.copy(shape, pressedShape, checkedShape)InputChip(shape)LargeExtendedFloatingActionButton(shape)LargeFloatingActionButton(shape)ListItemShapes.copy(shape, selectedShape, pressedShape, focusedShape, hoveredShape, draggedShape)MediumExtendedFloatingActionButton(shape)MediumFloatingActionButton(shape)ModalBottomSheet(shape)ModalDrawerSheet(drawerShape)ModalWideNavigationRail(collapsedShape, expandedShape)OutlinedButton(shape)OutlinedCard(shape)OutlinedIconButton(shape)OutlinedIconToggleButton(shape)OutlinedTextField(shape)OutlinedTextFieldDefaults.Container(shape)PlainTooltip(shape)PullToRefreshDefaults.IndicatorBox(shape)RichTooltip(shape)SearchBar(shape)SmallExtendedFloatingActionButton(shape)SmallFloatingActionButton(shape)SuggestionChip(shape)TextButton(shape)TextFieldDefaults.Container(shape)TextFieldDefaults.DecorationBox(shape)TimePickerDialog(shape)VerticalFloatingToolbar(shape)ButtonDefaults.shapes(shape, pressedShape)ButtonGroupDefaults.connectedLeadingButtonShapes(shape, pressedShape, checkedShape)ButtonGroupDefaults.connectedMiddleButtonShapes(shape, pressedShape, checkedShape)ButtonGroupDefaults.connectedTrailingButtonShapes(shape, pressedShape, checkedShape)ButtonShapes.copy(shape, pressedShape)CarouselItemScope.maskBorder(shape)clip(shape)dropShadow(shape)FilterChipDefaults.shapes(shape, selectedShape, pressedShape)graphicsLayer(shape)IconButtonDefaults.shapes(shape, pressedShape)IconButtonDefaults.toggleableShapes(shape, pressedShape, checkedShape)innerShadow(shape)InputChipDefaults.shapes(shape, selectedShape, pressedShape)ListItemDefaults.shapes(shape, selectedShape, pressedShape, focusedShape, hoveredShape, draggedShape)MenuDefaults.groupShapes(shape, inactiveShape)MenuDefaults.itemShapes(shape, selectedShape)MenuGroupShapes.copy(shape, inactiveShape)MenuItemShapes.copy(shape, selectedShape)MultiAspectCarouselScope.maskClip(shape)NavigationDrawerItem(shape)OutlinedSecureTextField(shape)PermanentDrawerSheet(drawerShape)ripple(focusRingShape)SearchBarDefaults.InputField(shape)SecureTextField(shape)SegmentedButton(shape)shadow(shape)Snackbar(shape)Surface(shape)TabRowDefaults.PrimaryIndicator(shape)TextField(shape)CarouselItemScope.maskClip(shape)CarouselItemScope.rememberMaskShape(shape)MultiAspectCarouselScope.maskBorder(shape)TextFieldDefaults.indicatorLine(textFieldShape)TimePickerDefaults.shapes(timeFieldShape, periodSelectorShape)TimePickerShapes.copy(timeFieldShape, periodSelectorShape)WideNavigationRail(shape)ToggleButtonDefaults.shapes(shape, pressedShape, checkedShape)ToggleButtonShapes.copy(shape, pressedShape, checkedShape)VerticalDragHandleDefaults.shapes(shape, pressedShape, draggedShape)
Functions
createOutline
fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density,
): Outline
Creates Outline of this shape for the given size.