Carbon Flutter
  • Overview ⚡️
  • Installation ⚙️
  • Widgets 🧩
    • Breadcrumb
    • Button
    • Checkbox
    • Form
    • Icons
    • Link
    • Notification
    • OverflowMenu
    • Text
    • TextField
    • Toggle
Powered by GitBook
On this page
  • Overview
  • Widget API
  • Example

Was this helpful?

  1. Widgets 🧩

Button

PreviousBreadcrumbNextCheckbox

Last updated 2 years ago

Was this helpful?

Overview

Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.

Widget API

Property
Description

onTap

Called when the button is tapped.

  • Type: VoidCallback

  • Default: required

label

A text to display in the button.

  • Type: String

  • Default: required

enable

Whether the toggle is enabled or not.

  • Type: bool

  • Default: true

kind

The kind that the button represents. It can be primary, secondary, danger, tertiary, ghost.

  • Type: CButtonKind

  • Default: CButtonKind.primary

size

The size of this button. It can be regular, sm, md.

  • Type: CToggleSize

  • Default: CToggleSize.regular

icon

An optional icon to display in the button.

  • Type: Widget?

  • Default: optional

expand

Whether the button should fill the available width.

  • Type: bool

  • Default: false

labelSize

The size (in logical pixels) to use when painting the label.

  • Type: double

  • Default: 14.0

Property
Description

onTap

Called when the button is tapped.

  • Type: VoidCallback

  • Default: required

icon

An icon to display in the button.

  • Type: Widget

  • Default: required

enable

Whether the toggle is enabled or not.

  • Type: bool

  • Default: true

kind

The kind that the button represents. It can be primary, secondary, danger, tertiary, ghost.

  • Type: CButtonKind

  • Default: CButtonKind.primary

size

The size of this button. It can be regular, sm, md.

  • Type: CToggleSize

  • Default: CToggleSize.regular

Example

CButton(
  label: 'Carbon Button',
  kind: CButtonKind.danger,
  icon: CIcon(CIcons.add, size: 16),
  size: CButtonSize.md,
  onTap: () {},
);

CButton.icon(
  kind: CButtonKind.danger,
  icon: CIcon(CIcons.add, size: 16),
  size: CButtonSize.md,
  onTap: () {},
);