shadcn_ui-checkbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShadcn UI — Checkbox
Shadcn UI — 复选框
Instructions
使用说明
ShadCheckboxvalueonChangedlabelsublabelShadCheckboxFormFieldidvalidatorShadCheckboxvalueonChangedlabelsublabelidvalidatorShadCheckboxFormFieldStandalone
独立使用
dart
ShadCheckbox(
value: value,
onChanged: (v) => setState(() => value = v),
label: const Text('Accept terms and conditions'),
sublabel: const Text(
'You agree to our Terms of Service and Privacy Policy.',
),
)dart
ShadCheckbox(
value: value,
onChanged: (v) => setState(() => value = v),
label: const Text('Accept terms and conditions'),
sublabel: const Text(
'You agree to our Terms of Service and Privacy Policy.',
),
)Form field
表单字段
dart
ShadCheckboxFormField(
id: 'terms',
initialValue: false,
inputLabel: const Text('I accept the terms and conditions'),
onChanged: (v) {},
inputSublabel: const Text('You agree to our Terms and Conditions'),
validator: (v) {
if (!v) return 'You must accept the terms and conditions';
return null;
},
)dart
ShadCheckboxFormField(
id: 'terms',
initialValue: false,
inputLabel: const Text('I accept the terms and conditions'),
onChanged: (v) {},
inputSublabel: const Text('You agree to our Terms and Conditions'),
validator: (v) {
if (!v) return 'You must accept the terms and conditions';
return null;
},
)