GitHub

Tabs

Tabs provide a way to navigate between panels that display related content without leaving the page.

Components

import { DaffTabsComponent } from '@daffodil/design/tabs'

Tabs provide a way to navigate between panels that display related content without leaving the page.

@Component()
class DaffTabsComponent implements AfterContentInit, OnInit {
  @Input() initiallySelected: string = null
  @Input() ariaLabel: string = ''
  @Input() linkMode: boolean = false
  @Input() url: string
  @Input() queryParam: string = 'tab'

  @Output() tabChange: EventEmitter<string> = new EventEmitter<string>()
}

Inputs

initiallySelected
string
Defaultnull
Description

The tab that is selected on initial load. If it's not used, the first tab in the tablist will be selected by default.

ariaLabel
string
Default''
Description

aria-label to label the tablist.

linkMode
boolean
Defaultfalse
Description

Replace the tab buttons as links.

url
string
Default
Description

The URL to navigate to when the component is in link mode. This component will set the specified query param.

queryParam
string
Default'tab'
Description

The query parameter that the tabs component will use to set the tab value in link mode.

Outputs

tabChange
EventEmitter
Default
Description

Event emitted when tab selection changes.


import { DaffTabPanelComponent } from '@daffodil/design/tabs'

Tab panel is the content area displayed when a tab is active.

@Component()
class DaffTabPanelComponent {}

import { DaffTabComponent } from '@daffodil/design/tabs'

Tab is a single tab in the tablist that is used to group the label of a tab panel and the tab panel together.

A <daff-tab> should include the DaffTabLabelComponent and DaffTabPanelComponent components in order to properly structure the UI.

@Component()
class DaffTabComponent {
  @Input() disabled: boolean = false
  @Input() id: string = 'daff-tab-' + tabId
}

Inputs

disabled
boolean
Defaultfalse
Description

Whether the tab is disabled.

id
string
Default'daff-tab-' + tabId
Description

A unique id for the tab component. Defaults to an autogenerated value. When using this, it's your responsibility to ensure that the id for each tab is unique.


import { DaffTabLabelComponent } from '@daffodil/design/tabs'

Tab label is the clicakble label that activates its corresponding tab panel. Labels can contain text, icons, or both.

@Component()
class DaffTabLabelComponent {}