Welcome UI logo
FOUNDATIONSCOMPONENTSBLOG650+
10.0.0

Menu

    Actions

    • Button
    • ButtonGroup
    • Close Button
    • Link

    Data display

    • Accordion
    • Avatar
    • Badge
    • Card
    • Swiper
    • Table
    • Tag
    • VisuallyHidden

    Feedback

    • Alert
    • StickyNote

      NEW

    • Toast

    Forms

    • Checkbox
    • DatePicker
    • DateTimePicker
    • Field
    • FileDrop
    • FileUpload
    • Hint
    • InputText
    • Label
    • PasswordInput
    • Radio
    • RadioGroup
    • RadioTab
    • Search
    • Select
    • Slider
    • Textarea
    • TimePicker
    • Toggle

    Icons & logo

    • Icon
    • IconStamp

      NEW

    • Logo
    • VariantIcon
    • WelcomeLoader

    Layout

    • AspectRatio
    • Loader
    • Window

      NEW

    Navigation

    • Breadcrumb
    • DropdownMenu
    • Pagination
    • Stepper

      NEW

    • Tabs

    Overlay

    • Drawer
    • Modal
    • Popover
    • Tooltip

    Typography

    • Text

    Utilities

    • Grid background

Overview

Props

Tabs

The Tabs component is a navigational element that allows users to switch between different views or sections of content within the same page. Each tab is associated with a content panel, and clicking a tab displays the corresponding panel while hiding others. This component helps organize content efficiently and improves user experience by providing easy access to different sections without leaving the current page.

SourceBuilt with Ariakit
Github
import { Tabs, useTab } from 'welcome-ui/Tabs'
const Example = () => {
const tab = useTab({ defaultSelectedId: 'tab1' })
return (
<>
<div>
<Tabs aria-label="Tabs" store={tab}>
<Tabs.Tab id="tab1" store={tab}>
Tab 1
</Tabs.Tab>
<Tabs.Tab id="tab2" store={tab}>
Tab 2
</Tabs.Tab>
<Tabs.Tab id="tab3" store={tab}>
Tab 3
</Tabs.Tab>
<Tabs.Tab id="tab4" store={tab}>
Tab 4
</Tabs.Tab>
<Tabs.Tab disabled id="tab5" store={tab}>
Tab 5
</Tabs.Tab>
</Tabs>
</div>
<div className="w-full border border-neutral-20 p-lg rounded-md">
<Tabs.Panel store={tab} tabId="tab1">
Content for Tab 1
</Tabs.Panel>
<Tabs.Panel store={tab} tabId="tab2">
Content for Tab 2
</Tabs.Panel>
<Tabs.Panel store={tab} tabId="tab3">
Content for Tab 3
</Tabs.Panel>
<Tabs.Panel store={tab} tabId="tab4">
Content for Tab 4
</Tabs.Panel>
<Tabs.Panel store={tab} tabId="tab5">
Content for Tab 5
</Tabs.Panel>
</div>
</>
)
}
export default Example

Examples

Sizes

Size is set on Tabs. Available sizes are sm and md. By default size is set to md.

Github

With a badge

Add a badge with passing a string or number to badge props.

Github

Icon

Add icon using icon="folder" and use a bunch of colors with iconColor props: blue, green, teal, pink, orange. Or use a custom icon with an Icon component.

Github

useTab

We use useTab from Ariakit Tab for the state of the Tab.

Pass options to useTab:

  • defaultSelectedId: e.g. const store = useTab({ defaultSelectedId: 'tab2' })
StepperDrawer

On this page

  • Definition
  • Examples
    • Sizes
    • With a badge
    • Icon
  • useTab
Made with by
Welcome to the jungle logo

Documentations

  • Foundations
  • Components
  • Source code

Updates

  • Releases
  • Issues

Community

  • Github
  • Twitter
  • Medium
  • Jobs