tabTriggerAttrs function

Map<String, String> tabTriggerAttrs({
  1. required String groupId,
  2. required String tabId,
  3. bool active = false,
  4. bool disabled = false,
})

Implementation

Map<String, String> tabTriggerAttrs({
  required String groupId,
  required String tabId,
  bool active = false,
  bool disabled = false,
}) {
  final Map<String, String> out = <String, String>{
    'data-arcane-tabs-group': groupId,
    'data-arcane-tab': tabId,
    'data-arcane-state': active ? 'active' : 'inactive',
    'role': 'tab',
    'aria-selected': active ? 'true' : 'false',
    'tabindex': active ? '0' : '-1',
  };
  if (disabled) out['data-arcane-disabled'] = 'true';
  return out;
}