buttons
New
Popular
PrimaryButton
The main call to action button for your app.
Frameworks:
Flutter
React Native
Expo
Interactive Preview
Rendered in high-fidelity native device frame
Interactive Live Sandbox
· Click elements inside device to testPrimaryButton
v2.0
SecondaryOutline
Test Touch Reaction0 taps
Apple iOS Human Interface
Code Implementation
Switch frameworks, copy code, or test in cloud sandbox
dart
1import 'package:flutter/material.dart';
2
3class PrimaryButton extends StatelessWidget {
4 final String label;
5 final VoidCallback onPressed;
6 final bool isLoading;
7 final IconData? icon;
8
9 const PrimaryButton({
10 super.key,
11 required this.label,
12 required this.onPressed,
13 this.isLoading = false,
14 this.icon,
15 });
16
17
18 Widget build(BuildContext context) {
19 return ElevatedButton(
20 onPressed: isLoading ? null : onPressed,
21 style: ElevatedButton.styleFrom(
22 backgroundColor: const Color(0xFFc026d3),
23 foregroundColor: Colors.white,
24 padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
25 shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
26 elevation: 0,
27 ),
28 child: isLoading
29 ? const SizedBox(width: 20, height: 20,
30 child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white))
31 : Row(
32 mainAxisSize: MainAxisSize.min,
33 children: [
34 if (icon != null) ...[Icon(icon, size: 18), const SizedBox(width: 8)],
35 Text(label, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
36 ],
37 ),
38 );
39 }
40}Component Properties
Configuration options and default values
| Prop | Type | Default | Description |
|---|---|---|---|
style | object | — | Custom styles. |
Related Components
Components frequently used alongside this pattern
SecondaryOutline
PrimaryButton
buttons
The main call to action button for your app.
SecondaryOutline
SecondaryButton
buttons
A subtle button for secondary actions.
SecondaryOutline
IconButton
buttons
A button that only contains an icon.
SecondaryOutline
FloatingActionButton
buttons
A prominent floating button for the primary screen action.