UNPKG

@accessible-web-components/tabs

Version:
67 lines (58 loc) 1.77 kB
<!DOCTYPE html> <html lang="en-GB"> <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <title>Tabs | Accessible Web Components</title> <meta name="viewport" content="width=device-width, initial-scale=1"/> <script type="module" src="../awc-tabs.js" async></script> </head> <body> <style> main { width: 50%; margin: auto; } awc-tab { border: 1px solid black; padding: 20px; } awc-panel { padding: 20px; background-color: lightgoldenrodyellow; } awc-tab[selected] { background-color: goldenrod; } awc-panel:not(:defined), awc-tab:not(:defined), awc-tabs:not(:defined) { display: block; } </style> <main> <h1>Tabs</h1> <section> <h2>Example</h2> <awc-tabs vertical> <awc-tab role="heading" slot="tab">Tab 1</awc-tab> <awc-panel role="region" slot="panel"> <h3>My first tab</h3> <p>Here is some text…</p> <ul> <li>…and a list</p> </ul> <button type="button">I am a focusable element within the tab</button> </awc-panel> <awc-tab role="heading" slot="tab">Tab 2</awc-tab> <awc-panel role="region" slot="panel">Content 2</awc-panel> <awc-tab role="heading" slot="tab">Tab 3</awc-tab> <awc-panel role="region" slot="panel">Content 3</awc-panel> <awc-tab role="heading" slot="tab">Tab 4</awc-tab> <awc-panel role="region" slot="panel">Content 4</awc-panel> </awc-tabs> <button>I am a focusable element outside the tab</button> </section> </main> </body> </html>