refactor(v2): render all tab panels at once (#3706)

* refactor(v2): render all tab panels at once

* Add ability to choose way to load tabs
This commit is contained in:
Alexey Pyltsyn 2020-11-09 19:06:07 +03:00 committed by GitHub
parent 498f8a0f27
commit 8c9f9487d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 15 deletions

View file

@ -296,6 +296,12 @@ And you will get the following:
<TabItem value="banana">This is a banana 🍌</TabItem>
</Tabs>
:::info
By default, tabs are rendered eagerly, but it is possible to load them lazily by passing the `lazy` prop to the `Tabs` component.
:::
### Syncing tab choices
You may want choices of the same kind of tabs to sync with each other. For example, you might want to provide different instructions for users on Windows vs users on macOS, and you want to changing all OS-specific instructions tabs in one click. To achieve that, you can give all related tabs the same `groupId` prop. Note that doing this will persist the choice in `localStorage` and all `<Tab>` instances with the same `groupId` will update automatically when the value of one of them is changed. Not that `groupID` are globally-namespaced.