diff --git a/README.md b/README.md index 08b1c0e..e45a4d8 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,9 @@ import '@github/tab-container-element' ```html -
- - - -
+ + +
Panel 1
@@ -35,8 +33,17 @@ import '@github/tab-container-element' ### Events -- `tab-container-change` (bubbles, cancelable): fired on `` before a new tab is selected and visibility is updated. `event.detail.relatedTarget` is the tab panel that will be selected if the event isn't cancelled. -- `tab-container-changed` (bubbles): fired on `` after a new tab is selected and visibility is updated. `event.detail.relatedTarget` is the newly visible tab panel. +- `tab-container-change` (bubbles, cancelable): fired on `` before a new tab is selected and visibility is updated. `event.tab` is the tab that will be focused and `tab.panel` is the panel that will be shown if the event isn't cancelled. +- `tab-container-changed` (bubbles): fired on `` after a new tab is selected and visibility is updated. `event.tab` is the tab that is now active (and will be focused right after this event) and `event.panel` is the newly visible tab panel. + +### Parts + +- `::part(tablist)` is the container which wraps all tabs. This element appears in ATs as it is `role=tablist`. +- `::part(panel)` is the container housing the currently active tabpanel. +- `::part(before-tabs)` is the container housing any elements that appear before the first `role=tab`. This also can be directly slotted with `slot=before-tabs`. +- `::part(after-tabs)` is the container housing any elements that appear after the last `role=tab`. This also can be directly slotted with `slot=after-tabs`. +- `::part(after-panels)` is the container housing any elements that appear after the last `role=tabpanel`. This can be useful if you want to add a visual treatment to the container but have content always appear visually below the active panel. + ### When tab panel contents are controls @@ -46,10 +53,33 @@ In those cases, apply `data-tab-container-no-tabstop` to the `tabpanel` element. ```html -
- - + + +
+
    +
  • branch-one
  • +
  • branch-two
  • +
+ + +``` + +### Vertical tabs + +If `` is given the `vertical` attribute it will apply the `aria-orientation=vertical` attribute to the tablist. This will present to ATs as a vertical tablist, and you can use the attribute to style the tabs accordingly. + +In those cases, apply `data-tab-container-no-tabstop` to the `tabpanel` element. + +```html + + +
  • branch-one