Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (refs T33323): add storybook documentation to DpTabs. #344

Merged
merged 13 commits into from
Jul 4, 2023
Merged
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Since v0.0.10, this Changelog is formatted according to the [Common Changelog][c

## UNRELEASED


### Added
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An "Added" section already exists!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6fb4106


- ([#344](https://github.com/demos-europe/demosplan-ui/pull/344)) Add documentation for DpTabs ([@ahmad-demos](https://github.com/@ahmad-demos))
- ([#333](https://github.com/demos-europe/demosplan-ui/pull/333)) Add "rounded" prop to DpButton, add "arrow-up" and "arrow-down" icons to DpIcon ([@spiess-demos](https://github.com/spiess-demos))

## v0.1.7 - 2023-06-27
Expand Down
39 changes: 39 additions & 0 deletions src/components/DpTabs/DpTabs.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Meta } from '@storybook/addon-docs'
import DpTabs from './DpTabs'

<Meta
title="Components/Tabs"
component={DpTabs} />

# DpTabs

The DpTabs component provides a structured and interactive way to organize and navigate related content, allowing users to switch between different views while keeping context.

DpTabs and DpTab both provide a default slot. For each tab, a `DpTab` instance is placed inside the default slot of `DpTabs`, while the content of each tab is placed inside the default slot of the respective `DpTab` instance.

The `DpTab` instances are then aligned horizontally, and each tab is associated with its header.

## Default usage

```html
<dp-tabs
tab-size="medium"
:active-id="activeTabId"
use-url-fragment
@change="setActiveTabId"> <!-- call a method -->
<dp-tab
id="idTab1"
label="Tab Title 1">
<slot>
Tab content 1.
</slot>
</dp-tab>
<dp-tab
id="idTab2"
label="Tab Title 2">
<slot>
Tab content 2.
</slot>
</dp-tab>
</dp-tabs>
```