We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post.
Accordion examples
-
# default
- Example item 2
{ "id": "default-example", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post." } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "default-example", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post." } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }} -
# with additional descriptions
Additional descriptionWe need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post.
- Example item 1
Additional description (wrapped in span)- Example item 2
{ "id": "with-descriptions", "items": [ { "heading": { "text": "Test" }, "summary": { "text": "Additional description" }, "content": { "html": "<p class=\"govuk-body\">\n We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post.\n</p>\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Test 2" }, "summary": { "html": "<span class=\"govuk-!-font-weight-regular\">Additional description (wrapped in span)</span>" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "with-descriptions", "items": [ { "heading": { "text": "Test" }, "summary": { "text": "Additional description" }, "content": { "html": "<p class=\"govuk-body\">\n We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post.\n</p>\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Test 2" }, "summary": { "html": "<span class=\"govuk-!-font-weight-regular\">Additional description (wrapped in span)</span>" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }} -
# with long content and description
Etiam diam dui, tempus ut pharetra in, aliquet non dui. Nunc pulvinar maximus tortor, ac finibus augue congue vitae. Donec sed cursus lorem.- Example item 1
Maecenas nec est sapien. Etiam varius luctus mauris non porttitor.- Example item 2
{ "id": "with-long-content-and-description", "items": [ { "heading": { "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc quis tortor porttitor." }, "summary": { "text": "Etiam diam dui, tempus ut pharetra in, aliquet non dui. Nunc pulvinar maximus tortor, ac finibus augue congue vitae. Donec sed cursus lorem." }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Praesent faucibus leo feugiat libero pharetra lacinia. Aliquam aliquet ante vitae mollis vestibulum." }, "summary": { "html": "<span class=\"govuk-!-font-weight-regular\">Maecenas nec <abbr>est</abbr> sapien. Etiam varius luctus mauris non porttitor. </span>" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "with-long-content-and-description", "items": [ { "heading": { "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc quis tortor porttitor." }, "summary": { "text": "Etiam diam dui, tempus ut pharetra in, aliquet non dui. Nunc pulvinar maximus tortor, ac finibus augue congue vitae. Donec sed cursus lorem." }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Praesent faucibus leo feugiat libero pharetra lacinia. Aliquam aliquet ante vitae mollis vestibulum." }, "summary": { "html": "<span class=\"govuk-!-font-weight-regular\">Maecenas nec <abbr>est</abbr> sapien. Etiam varius luctus mauris non porttitor. </span>" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }} -
# with all sections already open
{ "id": "all-sections-open-example", "items": [ { "heading": { "text": "Section A" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Section B" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "all-sections-open-example", "items": [ { "heading": { "text": "Section A" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Section B" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }} -
# classes
Some content
{ "id": "accordion-classes", "classes": "myClass", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-classes", "classes": "myClass", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }) }} -
# attributes
Some content
{ "id": "accordion-attributes", "attributes": { "data-attribute": "value" }, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-attributes", "attributes": { "data-attribute": "value" }, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }) }} -
# custom heading level
Some content
{ "id": "accordion-heading", "headingLevel": 3, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-heading", "headingLevel": 3, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }) }} -
# heading html
Some content
{ "id": "accordion-heading-html", "items": [ { "heading": { "html": "<span class=\"myClass\">Section A</span>" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-heading-html", "items": [ { "heading": { "html": "<span class=\"myClass\">Section A</span>" }, "content": { "text": "Some content" } } ] }) }} -
# with falsy values
Some content
Some content
{ "id": "accordion-falsy", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } }, false, "", null, { "heading": { "text": "Section B" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-falsy", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } }, false, "", null, { "heading": { "text": "Section B" }, "content": { "text": "Some content" } } ] }) }} -
# with remember expanded off
Some content
{ "id": "accordion-remember-expanded-off", "rememberExpanded": false, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "accordion-remember-expanded-off", "rememberExpanded": false, "items": [ { "heading": { "text": "Section A" }, "content": { "text": "Some content" } } ] }) }} -
# with focusable elements inside
{ "id": "with-focusable-elements", "items": [ { "heading": { "text": "Section A" }, "content": { "html": "<a class=\"govuk-link\" href=\"#\">Link A</a>" } }, { "heading": { "text": "Section B" }, "content": { "html": "<a class=\"govuk-link\" href=\"#\">Link B</a>" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "with-focusable-elements", "items": [ { "heading": { "text": "Section A" }, "content": { "html": "<a class=\"govuk-link\" href=\"#\">Link A</a>" } }, { "heading": { "text": "Section B" }, "content": { "html": "<a class=\"govuk-link\" href=\"#\">Link B</a>" } } ] }) }} -
# with one section open
- Example item 2
{ "id": "one-section-open-example", "items": [ { "heading": { "text": "Section A" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "one-section-open-example", "items": [ { "heading": { "text": "Section A" }, "expanded": true, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 1</li>\n</ul>\n" } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }} -
# with translations
We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post.
- Example item 2
{ "id": "with-translations", "hideAllSectionsText": "Collapse all sections", "showAllSectionsText": "Expand all sections", "hideSectionText": "Collapse", "hideSectionAriaLabelText": "Collapse this section", "showSectionText": "Expand", "showSectionAriaLabelText": "Expand this section", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post." } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }{% from "govuk/components/accordion/macro.njk" import govukAccordion %} {{ govukAccordion({ "id": "with-translations", "hideAllSectionsText": "Collapse all sections", "showAllSectionsText": "Expand all sections", "hideSectionText": "Collapse", "hideSectionAriaLabelText": "Collapse this section", "showSectionText": "Expand", "showSectionAriaLabelText": "Expand this section", "items": [ { "heading": { "text": "Section A" }, "content": { "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you cannot provide your nationality, you’ll have to send copies of identity documents through the post." } }, { "heading": { "text": "Section B" }, "content": { "html": "<ul class=\"govuk-list govuk-list--bullet\">\n <li>Example item 2</li>\n</ul>\n" } } ] }) }}