LogoSkills

coui-chip-input

Activate when creating chip inputs, tag inputs, multi-value text inputs, or token fields using ChipInput, ChipInput in CoUI Flutter or CoUI Web.

CoUI ChipInput#

Overview#

The ChipInput is a multi-item input component where users type text and press Enter to add items as chips (tags). It supports maximum chip limits, input validation, and individual add/remove callbacks. Flutter uses ChipInput while Web uses ChipInput.

Flutter (coui_flutter)#

Import#

import 'package:coui_flutter/coui_flutter.dart';

Basic Chip Input#

ChipInput(
  values: selectedTags,
  onChanged: handleTagsChanged,
  placeholder: 'ํƒœ๊ทธ ์ž…๋ ฅ ํ›„ Enter',
)

With Maximum Chips Limit#

ChipInput(
  values: selectedSkills,
  onChanged: handleSkillsChanged,
  onAdd: handleSkillAdded,
  onRemove: handleSkillRemoved,
  placeholder: '์Šคํ‚ฌ ์ถ”๊ฐ€',
  maxChips: 5,
)

With Input Validation#

ChipInput(
  values: emailList,
  onChanged: handleEmailListChanged,
  placeholder: '์ด๋ฉ”์ผ ์ถ”๊ฐ€',
  validator: (value) {
    final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
    if (!emailRegex.hasMatch(value)) return '์œ ํšจํ•œ ์ด๋ฉ”์ผ์„ ์ž…๋ ฅํ•˜์„ธ์š”';
    return null;
  },
)

Parameters#

ParameterTypeDefaultDescription
values List<String> required Current chip list
onChanged ValueChanged<List<String>>? null List change callback
onAdd ValueChanged<String>? null Chip addition callback
onRemove ValueChanged<String>? null Chip removal callback
placeholder String? null Input field placeholder
maxChips int? null Maximum number of chips
validator String? Function(String)? null Input validation function

Web (coui_web)#

Import#

import 'package:coui_web/coui_web.dart';

Basic ChipInput#

ChipInput(
  values: selectedTags,
  onChanged: handleTagsChanged,
  placeholder: 'ํƒœ๊ทธ ์ž…๋ ฅ ํ›„ Enter',
)

With Max Chips#

ChipInput(
  values: selectedSkills,
  onChanged: handleSkillsChanged,
  maxChips: 5,
  placeholder: '์Šคํ‚ฌ ์ถ”๊ฐ€',
)

Common Patterns#

Use Cases#

  • Tag Input: maxChips: 10 with placeholder "Enter tags"
  • Email Recipients: Use validator for email format validation

Platform Differences#

ConceptFlutterWeb
ComponentChipInputChipInput
API structureIdenticalIdentical