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

Enhancement: Simplify calcite-tabs structure #2721

Open
Tracked by #5529
jcfranco opened this issue Aug 3, 2021 · 7 comments
Open
Tracked by #5529

Enhancement: Simplify calcite-tabs structure #2721

jcfranco opened this issue Aug 3, 2021 · 7 comments
Assignees
Labels
1 - assigned Issues that are assigned to a sprint and a team member. breaking change Issues and pull requests with code changes that are not backwards compatible. enhancement Issues tied to a new feature or request. p - low Issue is non core or affecting less that 10% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.

Comments

@jcfranco
Copy link
Member

jcfranco commented Aug 3, 2021

Description

The current structure for tabs is a bit cumbersome for simple use cases:

<calcite-tabs ...>
  <calcite-tab-nav slot="tab-nav">
    <calcite-tab-title>title</calcite-tab-title>
    <calcite-tab-title>title</calcite-tab-title>
    <calcite-tab-title>title</calcite-tab-title>
  </calcite-tab-nav>

  <calcite-tab>content</calcite-tab>
  <calcite-tab>content</calcite-tab>
  <calcite-tab>content</calcite-tab>
</calcite-tabs>

The following structure is a proposal to simplify its usage and hopefully covers most basic use cases:

<calcite-tabs ...>
  <calcite-tab heading=title ...>content</calcite-tab>
  <calcite-tab heading=title ...>content</calcite-tab>
  <calcite-tab heading=title ...>content</calcite-tab>
</calcite-tabs>

To preserve existing tab-customization use cases, the following approaches could work:

  1. Adding "title" slot to allow customizing tab's title:

    <calcite-tabs ...>
      <calcite-tab ...>
        <div slot="title">Special title<calcite-icon icon=banana></calcite-icon></div>
        content
      </calcite-tab>
      <calcite-tab heading=title ...>content</calcite-tab>
      <calcite-tab heading=title ...>content</calcite-tab>
    </calcite-tabs>
  2. Adding icon-start/icon-end props to tab to quickly add an icon:

    <calcite-tabs ...>
      <calcite-tab heading=title icon-start=banana ...>content</calcite-tab>
      <calcite-tab heading=title ...>content</calcite-tab>
      <calcite-tab heading=title ...>content</calcite-tab>
    </calcite-tabs>

The first option seems the most flexible, as it would allow users to entirely customize the tab, including interactions (e.g., adding a close button that dismisses the tab when pressed).

Blocked issues: #9647, #10122, #6639

Acceptance Criteria

calcite-tabs follows the structure described above.

Relevant Info

From #1258 (comment)

There's other web component libs that follow this structure:

https://ant.design/components/tabs/
https://react.carbondesignsystem.com/?path=/story/components-tabs--playground
https://material-ui.com/components/tabs/

The only one that doesn't is Ionic (similar structure): https://ionicframework.com/docs/api/tabs

Which Component

calcite-tabs

Example Use Case

See example snippets.

@jcfranco jcfranco added enhancement Issues tied to a new feature or request. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Aug 3, 2021
@benelan benelan added deep freeze and removed needs triage Planning workflow - pending design/dev review. labels Sep 9, 2021
@benelan benelan added this to the Freezer milestone Sep 9, 2021
@geospatialem geospatialem added needs triage Planning workflow - pending design/dev review. and removed deep freeze needs triage Planning workflow - pending design/dev review. labels Dec 2, 2022
@driskull driskull added the breaking change Issues and pull requests with code changes that are not backwards compatible. label Dec 21, 2022
@driskull
Copy link
Member

@geospatialem I labeled this one a breaking change since it will restructure the tabs and probably make some events/properties no longer necessary.

@ashetland
Copy link
Contributor

This will likely be a refactor in Figma as well.

@geospatialem geospatialem added the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Mar 24, 2023
@macandcheese
Copy link
Contributor

@jcfranco anything we can do to move this along? Because the component now has built in closable, in addition to icon-start/end props , maybe option 2 above is a good direction as it ends up being consistent with current set up?

@macandcheese
Copy link
Contributor

macandcheese commented Nov 27, 2023

Another example of current usage - even though we are adding the heading property to Tab, to remove the Tab Nav and Tab Title components, I think we need to keep supporting the current "default slot" use case. Not a great name, but we'd basically need a tab-title-content slot within each Tab to preserve this:

Screenshot 2023-11-27 at 2 24 00 PM

Alongside the proposed heading property, I think we should pursue adding a description property at this time as it could often be called for in similar UI.

@brittneytewks brittneytewks removed the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Dec 12, 2023
@brittneytewks brittneytewks removed this from the 2024-04-30 - Apr Release milestone Mar 25, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Apr 3, 2024
@jcfranco jcfranco added the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Apr 22, 2024
@jcfranco jcfranco removed this from the 2024-05-28 - May Main Release milestone Apr 22, 2024
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels May 9, 2024
@geospatialem geospatialem added this to the 2024-07-30 - Jul Release milestone May 9, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label May 9, 2024
@geospatialem
Copy link
Member

The above blocks the effort of #9647. Depending on the above spike, will dictate the timing of carrying out, either for December (if the above is indeed a breaking change), or earlier (if a non-breaking change is carried out).

@geospatialem
Copy link
Member

Moving the spike effort post-3.0 for additional considerations, and if we can pursue a non-breaking change to the above in 2025, or if we should consider for 4.0 or beyond if we would like to pursue a breaking change to accommodate the components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - assigned Issues that are assigned to a sprint and a team member. breaking change Issues and pull requests with code changes that are not backwards compatible. enhancement Issues tied to a new feature or request. p - low Issue is non core or affecting less that 10% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.
Projects
None yet
Development

No branches or pull requests

8 participants