Link constructor

Link({
  1. required String href,
  2. Object? child,
  3. List<Object?> children = const [],
  4. String? target,
  5. String? rel,
  6. String? className,
  7. Map<String, Object?> props = const {},
  8. Map<String, Object?> style = const {},
  9. DartStyle? dartStyle,
  10. ButtonVariant? variant,
  11. Tone tone = Tone.primary,
  12. ComponentSize size = ComponentSize.md,
  13. bool disabled = false,
})

Creates a link to href with optional content and styles.

Implementation

Link({
  required String href,
  Object? child,
  List<Object?> children = const [],
  String? target,
  String? rel,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  ButtonVariant? variant,
  Tone tone = Tone.primary,
  ComponentSize size = ComponentSize.md,
  bool disabled = false,
}) : super(
        'a',
        props: mergeComponentProps(
          {
            ...props,
            'href': href,
            if (target != null) 'target': target,
            if (rel != null) 'rel': rel,
            if (disabled) 'aria-disabled': 'true',
          },
          className: className,
          dartStyle: variant == null
              ? dartStyle
              : buttonComponentStyle(
                  variant: variant,
                  tone: tone,
                  size: size,
                  disabled: disabled,
                  loading: false,
                ).merge(dartStyle),
          style: style,
        ),
        children: normalizeChildren(child, children),
      );