Skip to content

Extra

IconButton

A FormaUI icon button — "Material 3 with better defaults"; one entry point covers all four Material 3 icon button variants via variant, with a default-on press-scale micro-interaction (shared Modifier.formaPressScale) using a deeper 0.92 dip.

dev.formaui.components.iconbutton

StandardFilledTonalOutlined

Preview

This toggle is site chrome only — the preview has its own light/dark switch inside.

Live preview

Live preview — ~37 MB development build

Usage

FormaIconButton(onClick = { /* favorite */ }) {
    Icon(Icons.Default.Star, contentDescription = "Favorite")
}

FormaIconButton(onClick = { /* menu */ }, variant = FormaIconButtonVariant.Filled) {
    Icon(Icons.Default.Menu, contentDescription = "Open menu")
}

FormaIconButton

One entry point for all four M3 icon button variants via variant; supply the content slot yourself, typically an Icon with a contentDescription.

onClickrequiredType() -> UnitDefaultrequiredDescriptioncalled when the button is clicked. Not invoked while enabled is false.
modifierTypeModifierDefaultModifierDescriptionthe Modifier applied to the button.
variantTypeFormaIconButtonVariantDefaultFormaIconButtonVariant.StandardDescriptionthe visual emphasis (defaults to FormaIconButtonVariant.Standard).
enabledTypeBooleanDefaulttrueDescriptionwhether the button is interactive.
colorsTypeIconButtonColors?DefaultnullDescriptionthe container/content colors. When null, the Material 3 default colors for the chosen variant are used.
interactionSourceTypeMutableInteractionSource?DefaultnullDescriptionthe MutableInteractionSource for observing/emitting interactions. When null, one is remembered internally.
pressedScaleTypeFloatDefaultFormaIconButtonDefaults.PressedScaleDescriptionthe scale factor applied while the button is pressed (defaults to a deeper 0.92 — small targets need a larger relative dip to read). Must be greater than 0.
pressAnimationSpecTypeFiniteAnimationSpec<Float>?DefaultFormaPressScaleDefaults.AnimationSpecDescriptionthe animation used for the press-scale's release spring-back (defaults to a responsive spring; the press dip uses FormaPressScaleDefaults.DownAnimationSpec). Pass null to disable the press-scale entirely.
contentrequiredType@Composable () -> UnitDefaultrequiredDescriptionthe button's content — typically a single Icon with a contentDescription.

Supporting API

FormaIconButtonVariantenum
The visual emphasis of a FormaIconButton, mirroring Material 3's four icon button variants: Standard, Filled, Tonal, Outlined.
FormaIconButtonDefaultsobject
Defaults for FormaIconButton: PressedScale (0.92 — a deeper press-scale dip than larger controls, so the feedback reads at icon size).

Accessibility

48dp minimum touch target and Role.Button semantics inherited from the underlying Material 3 icon button; content should be an Icon with a contentDescription since the button carries no text label of its own.