Skip to content

Commit 112270d

Browse files
authored
Change Tabs api (#698)
* Change Tabs API (React) | Before | After | | ------------- | ------------ | | `Tabs` | `Tab.Group` | | `Tabs.List` | `Tab.List` | | `Tabs.Tab` | `Tab` | | `Tabs.Panels` | `Tab.Panels` | | `Tabs.Panel` | `Tab.Panel` | * Change Tabs API (Vue) | Before | After | | ------------ | ----------- | | `Tabs` | `TabGroup` | | `TabsList` | `TabList` | | `TabsTab` | `Tab` | | `TabsPanels` | `TabPanels` | | `TabsPanel` | `TabPanel` | * change playground example for Tabs (React) * update changelog
1 parent ba1bd52 commit 112270d

File tree

8 files changed

+1391
-1391
lines changed

8 files changed

+1391
-1391
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- Add new `Tabs` component ([#674](https://github.com/tailwindlabs/headlessui/pull/674))
12+
- Add new `Tabs` component ([#674](https://github.com/tailwindlabs/headlessui/pull/674), [#698](https://github.com/tailwindlabs/headlessui/pull/698))
1313
- Make `Disclosure.Button` close the disclosure inside a `Disclosure.Panel` ([#682](https://github.com/tailwindlabs/headlessui/pull/682))
1414
- Add `aria-orientation` to `Listbox`, which swaps Up/Down with Left/Right keys ([#683](https://github.com/tailwindlabs/headlessui/pull/683))
1515

1616
## [Unreleased - Vue]
1717

1818
### Added
1919

20-
- Add new `Tabs` component ([#674](https://github.com/tailwindlabs/headlessui/pull/674))
20+
- Add new `Tabs` component ([#674](https://github.com/tailwindlabs/headlessui/pull/674), [#698](https://github.com/tailwindlabs/headlessui/pull/698))
2121
- Make `DisclosureButton` close the disclosure inside a `DisclosurePanel` ([#682](https://github.com/tailwindlabs/headlessui/pull/682))
2222
- Add `aria-orientation` to `Listbox`, which swaps Up/Down with Left/Right keys ([#683](https://github.com/tailwindlabs/headlessui/pull/683))
2323

packages/@headlessui-react/pages/tabs/tabs-with-pure-tailwind.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react'
2-
import { Tabs, Switch } from '@headlessui/react'
2+
import { Tab, Switch } from '@headlessui/react'
33

44
import { classNames } from '../../src/utils/class-names'
55

@@ -11,7 +11,7 @@ export default function Home() {
1111
{ name: 'Billing', content: 'Tab content for billing' },
1212
]
1313

14-
let [manual, setManual] = useState(true)
14+
let [manual, setManual] = useState(false)
1515

1616
return (
1717
<div className="flex flex-col items-start w-screen h-full p-12 bg-gray-50 space-y-12">
@@ -40,10 +40,10 @@ export default function Home() {
4040
</Switch>
4141
</Switch.Group>
4242

43-
<Tabs className="flex flex-col max-w-3xl w-full" as="div" manual={manual}>
44-
<Tabs.List className="relative z-0 rounded-lg shadow flex divide-x divide-gray-200">
43+
<Tab.Group className="flex flex-col max-w-3xl w-full" as="div" manual={manual}>
44+
<Tab.List className="relative z-0 rounded-lg shadow flex divide-x divide-gray-200">
4545
{tabs.map((tab, tabIdx) => (
46-
<Tabs.Tab
46+
<Tab
4747
key={tab.name}
4848
disabled={tab.disabled}
4949
className={({ selected }) =>
@@ -69,18 +69,18 @@ export default function Home() {
6969
/>
7070
</>
7171
)}
72-
</Tabs.Tab>
72+
</Tab>
7373
))}
74-
</Tabs.List>
74+
</Tab.List>
7575

76-
<Tabs.Panels className="mt-4">
76+
<Tab.Panels className="mt-4">
7777
{tabs.map(tab => (
78-
<Tabs.Panel className="bg-white rounded-lg p-4 shadow" key={tab.name}>
78+
<Tab.Panel className="bg-white rounded-lg p-4 shadow" key={tab.name}>
7979
{tab.content}
80-
</Tabs.Panel>
80+
</Tab.Panel>
8181
))}
82-
</Tabs.Panels>
83-
</Tabs>
82+
</Tab.Panels>
83+
</Tab.Group>
8484
</div>
8585
)
8686
}

0 commit comments

Comments
 (0)