Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change tabs api #698

Merged
merged 4 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

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

## [Unreleased - Vue]

### Added

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

Expand Down
24 changes: 12 additions & 12 deletions packages/@headlessui-react/pages/tabs/tabs-with-pure-tailwind.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react'
import { Tabs, Switch } from '@headlessui/react'
import { Tab, Switch } from '@headlessui/react'

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

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

let [manual, setManual] = useState(true)
let [manual, setManual] = useState(false)

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

<Tabs className="flex flex-col max-w-3xl w-full" as="div" manual={manual}>
<Tabs.List className="relative z-0 rounded-lg shadow flex divide-x divide-gray-200">
<Tab.Group className="flex flex-col max-w-3xl w-full" as="div" manual={manual}>
<Tab.List className="relative z-0 rounded-lg shadow flex divide-x divide-gray-200">
{tabs.map((tab, tabIdx) => (
<Tabs.Tab
<Tab
key={tab.name}
disabled={tab.disabled}
className={({ selected }) =>
Expand All @@ -69,18 +69,18 @@ export default function Home() {
/>
</>
)}
</Tabs.Tab>
</Tab>
))}
</Tabs.List>
</Tab.List>

<Tabs.Panels className="mt-4">
<Tab.Panels className="mt-4">
{tabs.map(tab => (
<Tabs.Panel className="bg-white rounded-lg p-4 shadow" key={tab.name}>
<Tab.Panel className="bg-white rounded-lg p-4 shadow" key={tab.name}>
{tab.content}
</Tabs.Panel>
</Tab.Panel>
))}
</Tabs.Panels>
</Tabs>
</Tab.Panels>
</Tab.Group>
</div>
)
}
Loading