Input
Displays a form input field or a component that looks like an input field.
ConstrainedBox( constraints: const BoxConstraints(maxWidth: 320), child: const ShadInput( placeholder: Text('Email'), keyboardType: TextInputType.emailAddress, ),),With leading and trailing
class PasswordInput extends StatefulWidget { const PasswordInput({super.key});
@override State<PasswordInput> createState() => _PasswordInputState();}
class _PasswordInputState extends State<PasswordInput> { bool obscure = true;
@override Widget build(BuildContext context) { return ShadInput( placeholder: const Text('Password'), obscureText: obscure, leading: Icon(LucideIcons.lock), trailing: SizedBox.square( dimension: 24, child: OverflowBox( maxWidth: 28, maxHeight: 28, child: ShadIconButton( iconSize: 20, padding: EdgeInsets.all(2), icon: Icon(obscure ? LucideIcons.eyeOff : LucideIcons.eye), onPressed: () { setState(() => obscure = !obscure); }, ), ), ), ); }}Form
ShadInputFormField( id: 'username', label: const Text('Username'), placeholder: const Text('Enter your username'), description: const Text('This is your public display name.'), validator: (v) { if (v.length < 2) { return 'Username must be at least 2 characters.'; } return null; },),