David UI's Tabs component provides a dynamic and organized way to display content in switchable sections. Styled with Tailwind CSS, it supports customizable designs, smooth transitions, and responsive layouts for seamless navigation.
Explore our responsive Tabs component examples, styled with Tailwind CSS, perfect for enhancing user engagement in your web or mobile projects.
Try this straightforward implementation of the Tabs component featuring multiple tab options. Each tab displays distinct content, making it ideal for organizing and switching between different sections of a page or application.
An enhanced version of the Tabs component that incorporates icons for each tab. Perfect for creating visually appealing and intuitive navigation.
Content for Dashboard.
Use this example of a Tabs component with a vertical orientation. This layout is ideal for side navigation, allowing for clear separation of content while maintaining a structured and responsive design.
A vertical version of the Tabs component that includes icons alongside the tab labels. This setup is excellent for dashboards and side navigation menus, combining visual cues with usability.
A stylish implementation of the Tabs component with a transparent background. This design is ideal for blending seamlessly into minimalist or clean interfaces, offering smooth transitions and a light visual touch.
This variation of the Tabs component features an underlined indicator for the active tab. This design provides a clear, elegant, and modern visual cue to indicate the selected tab, making it a great fit for streamlined navigation menus.
Use this example to build a Tabs component with underline triggers and a subtle colored indicator, perfect for displaying tabs on a white or light-colored background.
The Tabs component in david-ai requires JavaScript to handle tab switching and content display. The library provides smooth transitions and interactive behavior through data attributes.
To use the Tabs component in your project, you first need to install the david-ai
library via npm:
If you prefer, you can use the DavidAI global object instead of directly importing initTabs:
You can include david-ai via a CDN and initialize tabs functionality globally in the browser. Add the following script to your HTML file:
David AI Tabs component can be used programmatically with TypeScript support for more control and type safety:
Learn how to use David AI's Tabs component with TypeScript for dynamic tab navigation. This component provides programmatic methods to switch between tabs, track active states, and configure tab behavior with full type safety and customization options. The TypeScript integration enables robust tab management with features like animated indicators, keyboard navigation, and flexible orientation settings.
The HTML structure demonstrates an accessible and interactive tabs component featuring:
Here's the complete HTML implementation:
The Tabs component provides a flexible way to organize content into tabbed sections. It supports customizable tab indicators, content panels, and programmatic control through methods like tab activation. The component includes smooth animations and keyboard navigation for enhanced user experience.
Interface | Property/Method | Type | Description |
---|---|---|---|
TabsConfig | orientation | 'horizontal' | 'vertical' | Sets the orientation of the tabs. Defaults to 'horizontal'. |
TabsConfig | defaultTabId | string | ID of the tab to be active by default. If not provided, first tab will be active. |
ITabs | activateTab(tabId: string) | void | Activates the tab with the specified ID. |
ITabs | cleanup() | void | Cleans up the tab group by removing event listeners and resetting the DOM. |