Skip to main content

Tabs Component

1. Introduction

The Tabs component is a user interface element that allows users to navigate between different sections of content within the same page. It organizes content into multiple panels, each associated with a tab, providing a clean and efficient way to display information without overwhelming the user.

Purpose and Use Cases

  • Purpose: The Tabs component is used to group and display related content in a compact and organized manner, allowing users to switch between sections without leaving the page.
  • Primary Use Cases:
    • Organizing content-heavy pages into manageable sections.
    • Displaying related data or settings in a single interface.
    • Enhancing user experience by reducing page clutter.

Benefits

  • Improved Usability: Simplifies navigation by grouping related content into tabs.
  • Customizable: Offers extensive styling and configuration options to match the application's design.
  • Interactive: Provides a seamless way for users to switch between content sections.
  • Responsive Design: Works seamlessly across desktop, tablet, and mobile devices.

2. Properties

The Tabs component comes with several configurable properties to suit different use cases. Below is a detailed breakdown:

Code

  • Description: A unique identifier for the component.
  • Purpose: Used to reference the component programmatically.
  • Required/Optional: Required

Per Tab (an array of tabs)

  • Description: Defines the individual tabs in the Tabs component.
  • Purpose: Allows configuration of each tab, including its name, icon, and order.
  • Sub-Properties:
    • Code: A unique identifier for each tab.
    • Name: The name or label of the tab.
    • Icon: An optional icon to visually represent the tab.
    • Arrow: Enables drag-and-drop functionality to reorder tabs.
    • Cross: Deletes the tab.
    • Chevron: Collapses the tab for better visual organization.
  • Required/Optional: Required

Add Tab

  • Description: A button to add a new tab to the Tabs component.
  • Purpose: Allows users to dynamically add tabs to the interface.
  • Required/Optional: Optional

3. Style

The Tabs component offers extensive styling options to ensure it aligns with the application's design. Below are the key styling properties:

Size and Position

  • Reset: Resets size and position settings to default.
  • Size:
    • Width & Height: Define the Tabs component's dimensions.
    • Min Size: Minimum width and height (default: none).
    • Max Size: Maximum width and height (default: none).
  • Position:
    • Alignment: Left, right, top, bottom (default: left, top).
    • X Position: Horizontal offset from the edge.
    • Y Position: Vertical offset from the edge.
  • Z-Index: Specifies the stack order of the Tabs component (default: 0).
  • Fixed Position: Locks the Tabs component's position on the screen (default: OFF).
  • Hidden: Hides the Tabs component from view (default: OFF).

Grid

  • Reset: Resets grid settings to default.
  • Options:
    • Columns: Number of columns in the grid (default: 12).
    • Column Gap Size: Space between columns, in pixels (default: 20px).
    • Column Color: Color of the grid columns (default: #ffe6e4).
    • Rows: Number of rows in the grid (default: 12).
    • Row Gap Size: Space between rows, in pixels (default: 20px).
    • Row Color: Color of the grid rows (default: #fe645a).
    • Snap: Snap-to-grid spacing, in pixels (default: 10).
    • Show Grid: Toggles the visibility of the grid (default: OFF).

Overflow

  • Options: Normal, On Hover.
    • Overflow X: Controls horizontal overflow (visible, hidden, scroll, auto, initial, inherit).
    • Overflow Y: Controls vertical overflow (visible, hidden, scroll, auto, initial, inherit).

Border

  • Reset: Resets border settings to default.
  • Options: Normal, On Hover.
    • Edges: Left, right, top, bottom, or all edges.
    • Type: None, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset, initial, inherit (default: none).
    • Color: Hexadecimal color code with a color picker.
    • Width: Border width in pixels.
    • Radius: Corner radius for rounded edges (default: none).

Padding

  • Reset: Resets padding settings to default.
  • Options: Normal, On Hover.
    • Sides: Left, right, top, bottom, or all edges.
    • Size: Padding size in pixels.

Background

  • Reset: Resets background settings to default.
  • Normal:
    • Background Color: Hexadecimal color code with a color picker (default: none).
    • Source: Media library or HTTP URL.
    • Attachment: Scroll, fixed, local, initial, inherit.
    • Position: X and Y positions in pixels (default: 0).
    • Repeat: Repeat, repeat-x, repeat-y, no-repeat, initial, inherit.
    • Size: Auto, length, cover, contain, initial, inherit.
    • Origin: Border-box, padding-box, content-box, initial, inherit.
  • On Hover:
    • Same properties as "Normal" but applied when the Tabs component is hovered.

Tab Styles

  • Options: Normal, On Hover.
    • Font Size: Pixels (default: 14).
    • Letter Spacing: Number expressed in em, px, or rem units.
    • Word Spacing: Number expressed in em, px, or rem units.
    • Line Height: Number expressed in em, px, or rem units.
    • Weight: Thin, light, extra light, normal, medium, semi-bold, bold, extra bold, black (default: normal).
    • Color: Hexadecimal color code with a color picker (default: none).
    • Text Decoration: Line, style, thickness, and color options.

Tab Panel

  • Options: Normal, On Hover.
    • Background Color: Hexadecimal color code with a color picker (default: none).
    • Source: Media library or HTTP URL.
    • Attachment: Scroll, fixed, local, initial, inherit.
    • Position: X and Y positions in pixels (default: 0).
    • Repeat: Repeat, repeat-x, repeat-y, no-repeat, initial, inherit.
    • Size: Auto, length, cover, contain, initial, inherit.
    • Origin: Border-box, padding-box, content-box, initial, inherit.

4. Best Practices for UI/UX

When and Why to Use

  • Use the Tabs component to organize content into manageable sections.
  • Ideal for applications with multiple related data sets or settings.

Effective Scenarios

  • Desktop: Use for content-heavy pages to improve navigation.
  • Tablet/Smartphone: Ensure the Tabs component is responsive and easy to interact with on smaller screens.

Tips for Optimal Use

  • Use clear and concise labels for each tab.
  • Provide visual feedback for the active tab.
  • Ensure the content in each tab is logically grouped and relevant.

5. Security Considerations

Potential Risks

  • State Mismanagement: Ensure the Tabs component's state is accurately reflected in the application logic.
  • External Resources: Validate any external resources used for icons or backgrounds.

Best Practices

  • Use HTTPS for secure communication when transmitting tab data.
  • Validate and sanitize all user inputs to prevent injection attacks.
  • Test the Tabs component's responsiveness and behavior across different devices and screen sizes.