Skip to content

Commit

Permalink
Add new table for the data object
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jun 12, 2024
1 parent d8d740c commit 5e6e344
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ showTabs: true
---

import PropertiesTable from 'dnb-design-system-portal/src/shared/parts/PropertiesTable'
import { TabsProperties } from '@dnb/eufemia/src/components/tabs/TabsDocs'
import {
TabsProperties,
TabsDataObject,
} from '@dnb/eufemia/src/components/tabs/TabsDocs'

## Properties

<PropertiesTable props={TabsProperties} />

## Data object

<PropertiesTable props={TabsDataObject} />

## Key

The key can be a string or a number.
Expand Down
37 changes: 31 additions & 6 deletions packages/dnb-eufemia/src/components/tabs/TabsDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ export const TabsProperties: PropertiesTableProps = {
type: 'React.ReactNode',
status: 'optional',
},
data: {
doc: "defines the data structure to load as a JSON. e.g. `[{title: '...', content: 'Current tab', key: '...', hash: '...'}]`",
type: [
'string',
'{title: string | React.ReactNode, key: string | number, selected?: boolean, disabled?: boolean}',
],
'[data](/uilib/components/tabs/properties/#data-object)': {
doc: 'defines the data structure to load as an object.',
type: 'object',
status: 'required',
},
children: {
Expand Down Expand Up @@ -104,6 +101,34 @@ export const TabsProperties: PropertiesTableProps = {
},
}

export const TabsDataObject: PropertiesTableProps = {
title: {
doc: 'The title of the tab.',
type: ['string', 'React.ReactNode'],
status: 'required',
},
key: {
doc: 'The unique key of the tab.',
type: ['string', 'number'],
status: 'required',
},
content: {
doc: 'The content of the tab.',
type: 'React.ReactNode',
status: 'optional',
},
selected: {
doc: 'If set to `true`, the tab will be selected.',
type: 'boolean',
status: 'optional',
},
disabled: {
doc: 'If set to `true`, the tab will be disabled.',
type: 'boolean',
status: 'optional',
},
}

export const TabsEvents: PropertiesTableProps = {
on_change: {
doc: '(preferred) this event gets triggered once the tab changes its selected key. Returns `{ key, selected_key, focus_key, event }`.',
Expand Down

0 comments on commit 5e6e344

Please sign in to comment.