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' ;
ChipInput (
values: selectedTags,
onChanged: handleTagsChanged,
placeholder: 'ํ๊ทธ ์
๋ ฅ ํ Enter' ,
)
With Maximum Chips Limit #
ChipInput (
values: selectedSkills,
onChanged: handleSkillsChanged,
onAdd: handleSkillAdded,
onRemove: handleSkillRemoved,
placeholder: '์คํฌ ์ถ๊ฐ' ,
maxChips: 5 ,
)
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 #
Parameter Type Default Description
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' ;
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
Concept Flutter Web
Component ChipInputChipInput
API structure Identical Identical