This tabs component works without JavaScript by using a combination of anchors, which point to the tabpanels, and CSS, that shows the correct tabpanel using :target
.
If JavaScript is enabled, the behavior will be enhanced and the anchors will be replaced using buttons. The implementation is roughly based on this Example of Tabs with Automative Activation on w3.org.
src/components/patterns/tabs
// src/components/patterns/tabs/schema.yaml
$schema: http://json-schema.org/draft-07/schema
$id: /patterns/tabs
additionalProperties: false
type: object
required:
- tabs
- content
properties:
is_interactive:
$ref: /patterns/tabs/tabs-list#/properties/is_interactive
tabs:
$ref: /patterns/tabs/tabs-list#/properties/tabs
content:
type: array
items:
type: object
additionalProperties: false
required:
- content
- id
properties:
content:
type: string
format: html
description: patterns/*
id:
type: string
is_selected:
type: boolean
// src/components/patterns/tabs/mocks.yaml
$ref: patterns/tabs/tabs-list#interactive
content:
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#graph
id: tab-1
is_selected: true
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#teasers
id: tab-2
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#stats
id: tab-3
// src/components/patterns/tabs/tabs.html.twig
<div class="Tabs u-pageMainChild u-container js-Tabs" data-js="false">
{% if heading %}
<div class="Tabs-heading">
{{ heading }}
</div>
{% endif %}
{% include "@patterns/tabs/tabs-list/tabs-list.html.twig" with {
is_interactive: is_interactive,
tabs: tabs,
} only %}
<div class="Tabs-tabpanels">
{% for item in content %}
<div class="Tabs-tabpanel" role="tabpanel" tabindex="-1" id="{{ item.id }}" aria-labelledby="{{ item.id }}"{% if not item.is_selected %} hidden{% endif %}>
{{ item.content|raw }}
</div>
{% endfor %}
</div>
</div>
default mock data
$ref: patterns/tabs/tabs-list#interactive
content:
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#graph
id: tab-1
is_selected: true
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#teasers
id: tab-2
- content:
$tpl: patterns/tabs/tabs-content
$ref: patterns/tabs/tabs-content#stats
id: tab-3
Jeder Beitrag zählt! Über 67% der Spenden fließen direkt in Kampagnen, die den Schutz unserer Umwelt vorantreiben. Weitere Mittel werden in Kommunikation, Werbung und Verwaltung investiert, um die Wirkung unserer Arbeit zu maximieren.
Mehr erfahren in unserem JahresberichtGreenpeace ist stolz darauf, Siegel wie das der "Initiative Transparente Zivilgesellschaft" zu tragen. Wir setzen auf volle Offenlegung unserer Finanzen, um Ihr Vertrauen zu stärken und unsere Arbeit so nachvollziehbar wie möglich zu gestalten.
Einsatzländer
Ehrenamtliche und Aktive
Förder:innen
Ende der Atomkraft! Jahrzehntelang wurde protestiert - am 15. April 2023 war es endlich soweit: Deutschland steigt aus der Atomkraft aus und es ist Schluss mit der hochriskanten Produktion von Atomstrom. Ein wahrer Grund zum Feiern!
Gemeinsam mit über 54.000 Mitkläger:innen haben Greenpeace und Germanwatch am 16. September 2024 eine neue Verfassungsbeschwerde gegen die unzureichende Klimapolitik der Bundesregierung beim Bundesverfassungsgericht in Karlsruhe eingereicht.
Wegen Greenwashing muss die Deutsche-Bank-Tochter DWS 25 Millionen Euro Strafe zahlen. Das ist die höchste Strafe, die jemals in Deutschland wegen Greenwashing-Delikten verhängt wurde. Endlich hat Greenwashing auch strafrechtliche Konsequenzen.