Tabbed views
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Th' tabs
shorrrtcode displays arbitrary rrrambl'n 'n unlimited number o' tabs. This comes 'n handy eg. fer provid'n code snippets fer multiple languages or provid'n configurat'n 'n different formats.
print("Hello World!")
echo "Hello World!"
Usage
While th' examples be us'n shorrrtcodes wit' named parameter ye be free t' also call this shorrrtcode from yer own partials.
{{< tabs >}}
{{% tab name="python" %}}
```python
print("Hello World!")
```
{{% /tab %}}
{{% tab name="bash" %}}
```bash
echo "Hello World!"
```
{{% /tab %}}
{{< /tabs >}}
{{ partial "shortcodes/tabs.html" (dict
"context" .
"tabs" (slice
(dict
"name" "python"
"content" ("```python\nprint(\"Hello World!\")\n```" | markdownify)
)
(dict
"name" "bash"
"content" ("```bash\necho \"Hello World!\"\n```" | markdownify)
)
)
)}}
Parameter
Name | Default | Notes |
---|---|---|
groupId | default |
Arbitrary name o' th' group th' tab view belongs t'. Tab views wit' th' same groupId sychr'nize their selected tab. This sychronizat'n applies t' th' whole ship! |
<content> | <empty> | Arbitrary number o' tabs defined wit' th' tab sub-shortcode. |
When us'n tab views wit' different rrrambl'n sets, make sure t' use a common groupId
fer equal sets o' tabs but distinct groupId
fer different sets.
Th' tab select'n be restored automatically based on th' groupId
an' if it cannot find a tab item because it came from th' 'default'
group on a different plank then th' first tab be selected instead.
Examples
Distinct groupId
{{< tabs groupId="config" >}}
{{% tab name="json" %}}
```json
{
"Hello": "World"
}
```
{{% /tab %}}
{{% tab name="XML" %}}
```xml
<Hello>World</Hello>
```
{{% /tab %}}
{{% tab name="properties" %}}
```properties
Hello = World
```
{{% /tab %}}
{{< /tabs >}}
{
"Hello": "World"
}
<Hello>World</Hello>
Hello = World
Non-Distinct groupId
See what happens t' this tab view if ye select properties tab from th' previous example.
{{< tabs groupId="config" >}}
{{% tab name="json" %}}
```json
{
"Hello": "World"
}
```
{{% /tab %}}
{{% tab name="XML" %}}
```xml
<Hello>World</Hello>
```
{{% /tab %}}
{{< /tabs >}}
{
"Hello": "World"
}
<Hello>World</Hello>