Skip to content

Commit

Permalink
Document tabs shortcode (#794)
Browse files Browse the repository at this point in the history
Co-authored-by: Heitor Tashiro Sergent <[email protected]>
  • Loading branch information
jdbaldry and heitortsergent authored Jul 30, 2024
1 parent ce1d066 commit cc0367f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/validate-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build website
run: |
docker run -v ${PWD}/docs/sources:/hugo/content/docs/writers-toolkit -e HUGO_REFLINKSERRORLEVEL=ERROR --rm grafana/docs-base:latest /bin/bash -c 'make hugo'
docker run -v ${PWD}/docs/sources:/hugo/content/docs/writers-toolkit -e HUGO_REFLINKSERRORLEVEL=ERROR --rm grafana/docs-base:nightly /bin/bash -c 'make hugo'
vale:
runs-on: ubuntu-latest
container:
Expand Down
40 changes: 40 additions & 0 deletions docs/sources/write/shortcodes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,46 @@ You should generally avoid using this shortcode because every documentation page
{{</* table-of-contents */>}}
```

## Tabs

The `tabs` shortcode creates generic tabbed content.
The website saves the selected tab to browser storage and persists it across navigation.

You create a tab using the `tab-content` shortcode within the `tabs` shortcode.
The inner of the `tab-content` can be any Markdown.

{{< admonition type="note" >}}
You can nest a `code` shortcode inside of a `tab-content` shortcode, but you can't nest a `tabs` shortcode inside of a `tab-content` shortcode.
{{< /admonition >}}
| Parameter | Description | Required |
| --------- | -------------------------------------------- | -------- |
| name | Name of the tab displayed in the tabs header | yes |
### Example
```markdown
{{</* tabs */>}}
{{</* tab-content name="One" */>}}
This is the first tab.
{{</* /tab-content */>}}
{{</* tab-content name="Two" */>}}
This is the second tab.
{{</* /tab-content */>}}
{{</* /tabs */>}}
```
Produces:
{{< tabs >}}
{{< tab-content name="One" >}}
This is the first tab.
{{< /tab-content >}}
{{< tab-content name="Two" >}}
This is the second tab.
{{< /tab-content >}}
{{< /tabs >}}
## Term
The `term` shortcode enables a tooltip when a user hovers over text surrounded by the shortcode.
Expand Down

0 comments on commit cc0367f

Please sign in to comment.