Skip to content

Refactor: Extract TabListItem as a separate component in Tabs #2654

@subhamkumarr

Description

@subhamkumarr

Description

The Tabs component in src/theme/Tabs/index.tsx currently defines the list items for tabs inline within the TabList component. There is an explicit TODO comment indicating that this should be extracted:

// TODO extract TabListItem

Refactoring this into a separate component will improve code readability, maintainability, and testability.

Location

  • File: src/theme/Tabs/index.tsx
  • Line: ~77 (inside TabList function)

Proposed Solution

  1. Create a new component TabListItem (either in the same file or a new file).
  2. Move the logic for rendering the <li> element into this new component.
  3. Pass necessary props (value, label, attributes, selectedValue,
    handleKeydown, handleTabChange, tabRefs) to TabListItem.
  4. Replace the inline <li> with <TabListItem />.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions