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 🧩

Form

PreviousCheckboxNextIcons

Last updated 2 years ago

Was this helpful?

Overview

Forms are used for submitting data so be as concise as possible when designing. Keep it short. Think about each field and what value the data will provide. What do you gain by collecting this information?

Widget API

Property
Description

children

The content of the form.

  • Type: List<Widget>

  • Default: required

enable

Whether the form is enabled or not.

  • Type: bool

  • Default: true

type

The type of the form. It can be group, blank.

  • Type: CFormType

  • Default: CFormType.blank

action

An action widget to display at the end of the form.

  • Type: Widget?

  • Default: optional

Example

CForm(
  type: CFormType.blank,
  action: CButton(
    label: 'Action Button',
    onTap: () {},
    icon: Icon(CIcons.add, size: 16),
    ),
    children: [
      CTextField(label: 'Label', description: 'Description'),
      const SizedBox(height: 16),
      CTextField(
        label: 'Label',
        description: 'Description',
        validator: (value) {
          return CValidationResult(
            kind: CValidationKind.error,
            message: 'Your input is incorrect',
          );
        },
      ),
    ],
);