IconButton
A button component that displays only an icon, perfect for toolbars and compact interfaces
A button component that displays only an icon with loading state support.
When to use this
- Toolbars: Create compact action buttons in toolbars and app bars
- Icon actions: Provide quick actions with recognizable icons
- Space-constrained interfaces: Use where space is limited
- Floating actions: Create floating action buttons with custom styling
Basic implementation
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class IconButtonExample extends StatelessWidget {
const IconButtonExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16,
children: [
RemixIconButton(
icon: CupertinoIcons.heart,
onPressed: () {},
style: style,
),
RemixIconButton(
icon: CupertinoIcons.heart,
onPressed: () {},
style: style,
loading: true,
),
],
);
}
RemixIconButtonStyle get style {
return RemixIconButtonStyle()
.iconColor(Colors.blueGrey.shade700)
.iconSize(22)
.size(40, 40)
.color(Colors.blueGrey.shade50.withValues(alpha: 0.6))
.borderAll(color: Colors.blueGrey.shade100, width: 1.5)
.borderRadiusAll(const Radius.circular(8))
.spinner(
RemixSpinnerStyle()
.size(22)
.strokeWidth(1.3)
.indicatorColor(Colors.blueGrey.shade600),
)
.onHovered(
RemixIconButtonStyle()
.color(Colors.blueGrey.shade100.withValues(alpha: 0.4)),
)
.onPressed(
RemixIconButtonStyle()
.color(Colors.blueGrey.shade100.withValues(alpha: 0.8)),
);
}
}
Fortal styles
Remix includes Fortal-themed style helpers for this component:
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class FortalIconButtonExample extends StatelessWidget {
const FortalIconButtonExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
spacing: 16,
children: [
RemixIconButton(
icon: Icons.add,
onPressed: () {},
style: FortalIconButtonStyle.solid(),
),
RemixIconButton(
icon: Icons.edit,
onPressed: () {},
style: FortalIconButtonStyle.soft(),
),
RemixIconButton(
icon: Icons.delete,
onPressed: () {},
style: FortalIconButtonStyle.ghost(),
),
],
);
}
}
See the FortalIconButtonStyle source code for all available options.
Constructor
const RemixIconButton({
Key? key,
required IconData icon,
RemixIconButtonIconBuilder? iconBuilder,
RemixIconButtonLoadingBuilder? loadingBuilder,
bool loading = false,
bool enabled = true,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
VoidCallback? onDoubleTap,
FocusNode? focusNode,
bool autofocus = false,
bool enableFeedback = true,
String? semanticLabel,
String? semanticHint,
bool excludeSemantics = false,
MouseCursor mouseCursor = SystemMouseCursors.click,
RemixIconButtonStyle style = const RemixIconButtonStyle.create(),
RemixIconButtonSpec? styleSpec,
})
loadingBuilder → RemixIconButtonLoadingBuilder?
Optional. Builder for customizing the loading state rendering.
autofocus → bool
Optional. Whether the button should automatically request focus when it is created.
loading → bool
Optional. Whether the button is in a loading state. When true, the button will display a spinner and become non-interactive.
enableFeedback → bool
Optional. Whether to provide feedback when the button is pressed. Defaults to true.
onPressed → VoidCallback?
Required. Callback function called when the button is pressed. If null, the button will be considered disabled.
semanticLabel → String?
Optional. The semantic label for the button. Used by screen readers to describe the button.
semanticHint → String?
Optional. The semantic hint for the button. Provides additional context about what will happen when the button is activated.
excludeSemantics → bool
Optional. Whether to exclude child semantics. When true, the semantics of child widgets will be excluded. Defaults to false.

