Tabs constructor

Tabs({
  1. List<TabItem> tabs = const [],
  2. String? activeKey,
  3. NavVariant variant = NavVariant.underline,
  4. Tone tone = Tone.primary,
  5. ComponentSize size = ComponentSize.md,
  6. String? className,
  7. Map<String, Object?> props = const {},
  8. Map<String, Object?> style = const {},
  9. DartStyle? dartStyle,
  10. void onChanged(
    1. Object event,
    2. TabItem tab
    )?,
})

Creates a tablist from tabs.

Implementation

Tabs({
  List<TabItem> tabs = const [],
  String? activeKey,
  NavVariant variant = NavVariant.underline,
  Tone tone = Tone.primary,
  ComponentSize size = ComponentSize.md,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  void Function(Object event, TabItem tab)? onChanged,
}) : super(
        'div',
        props: mergeComponentProps(
          {...props, 'role': props['role'] ?? 'tablist'},
          className: className,
          defaultStyle: const {
            'display': 'flex',
            'align-items': 'center',
            'gap': '4px',
            'border-bottom': '1px solid #e4e7ec',
          },
          dartStyle: dartStyle,
          style: style,
        ),
        children: [
          for (final tab in tabs)
            _tabButton(
              tab,
              selected: tab.key == activeKey,
              variant: variant,
              tone: tone,
              size: size,
              onChanged: onChanged,
            ),
        ],
      );