input

InputElement input({

  1. String? type,
  2. String? value,
  3. String? placeholder,
  4. void onChange(
    1. SyntheticEvent
    )?,
  5. void onInput(
    1. SyntheticEvent
    )?,
  6. void onFocus(
    1. SyntheticFocusEvent
    )?,
  7. void onBlur(
    1. SyntheticFocusEvent
    )?,
  8. Map<String, dynamic>? props,
  9. Map<String, dynamic>? style,
  10. String? className,
})

Create an input element

Implementation

InputElement input({
  String? type,
  String? value,
  String? placeholder,
  void Function(SyntheticEvent)? onChange,
  void Function(SyntheticEvent)? onInput,
  void Function(SyntheticFocusEvent)? onFocus,
  void Function(SyntheticFocusEvent)? onBlur,
  Map<String, dynamic>? props,
  Map<String, dynamic>? style,
  String? className,
}) {
  final p = _buildProps(props: props, style: style, className: className);
  if (type != null) p['type'] = type;
  if (value != null) p['value'] = value;
  if (placeholder != null) p['placeholder'] = placeholder;
  if (onChange != null) {
    void handler(JSObject e) => onChange(SyntheticEvent.fromJs(e));
    p['onChange'] = handler;
  }
  if (onInput != null) {
    void handler(JSObject e) => onInput(SyntheticEvent.fromJs(e));
    p['onInput'] = handler;
  }
  if (onFocus != null) {
    void handler(JSObject e) => onFocus(SyntheticFocusEvent.fromJs(e));
    p['onFocus'] = handler;
  }
  if (onBlur != null) {
    void handler(JSObject e) => onBlur(SyntheticFocusEvent.fromJs(e));
    p['onBlur'] = handler;
  }
  return InputElement.fromJS(createElement('input'.toJS, createProps(p)));
}