$img

ImgElement $img({

  1. required String src,
  2. String? alt,
  3. String? className,
  4. String? id,
  5. int? width,
  6. int? height,
  7. Map<String, dynamic>? style,
  8. Map<String, dynamic>? props,
  9. void onClick()?,
})

Creates an <img> element (self-closing, no children).

Implementation

ImgElement $img({
  required String src,
  String? alt,
  String? className,
  String? id,
  int? width,
  int? height,
  Map<String, dynamic>? style,
  Map<String, dynamic>? props,
  void Function()? onClick,
}) {
  final p = _buildJsxProps(
    className: className,
    id: id,
    style: style,
    props: props,
    onClick: onClick,
  );
  p['src'] = src;
  if (alt != null) p['alt'] = alt;
  if (width != null) p['width'] = width;
  if (height != null) p['height'] = height;
  return ImgElement.fromJS(_createJsxElement('img', p));
}