--- layout: layouts/component.njk title: Tabs description: A set of layered sections of content—known as tab panels—that are displayed one at a time. toc: - label: Usage id: usage children: - label: HTML + Javascript id: usage-default - label: Jinja or Nunjucks id: usage-jinja --- {% from "macros/code_preview.njk" import code_preview %} {% from "macros/code_block.njk" import code_block %} {% from "components/tabs.njk" import tabs %} {% set code_html %} {% set account_panel %}
Make changes to your account here. Click save when you're done.
Change your password here. After saving, you'll be logged out.
You will need to include the Javascript (Alpine.js) code provided below before the HTML code for this component. As with all interactive components, you will need to add some Alpine.js properties to certain elements (e.g. x-bind, x-data, @click).
The component is structured as such:
<div class="tabs"> which wraps around the entire component and holds it state (e.g. open/close).<nav role="tablist"> that holds the tab buttons (<button role="tab">).<div role="tabpanel"> that holds the tab panels corresponding to each tab button.If you use Jinja (or Nunjucks), you can use the tabs() macro directly. Read more about using Basecoat with Jinja and Nunjucks.
Make changes to your account here. Click save when you're done.
Change your password here. After saving, you'll be logged out.