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

[Tabs] Implement new API #212

Closed
Tracked by #211 ...
michaldudak opened this issue Mar 21, 2024 · 0 comments · Fixed by #245
Closed
Tracked by #211 ...

[Tabs] Implement new API #212

michaldudak opened this issue Mar 21, 2024 · 0 comments · Fixed by #245
Assignees
Labels
component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@michaldudak
Copy link
Member

michaldudak commented Mar 21, 2024

Anatomy

<Tabs>
  <Tabs.List aria-label="Tabs">
    <Tabs.Tab value="tab-1">Tab 1</Tabs.Tab>
    <Tabs.Tab value="tab-2">Tab 2</Tabs.Tab>
  </Tabs.List>
  <Tabs.Panel value="tab-1">
    Panel 1
  </Tabs.Panel>
  <Tabs.Panel value="tab-2">
    Panel 2
  </Tabs.Panel>
</Tabs>

// Rendered HTML
<div dir="ltr" className="base--horizontal">
  <div className="base--horizontal" role="tablist" aria-label="Tabs" aria-orientation="horizontal">
    <button type="button" role="tab" tabindex="0" aria-selected="true" id=":r1:" aria-controls=":r3:" data-orientation="horizontal" data-selected="true">Tab 1</button>
    <button type="button" role="tab" tabindex="-1" aria-selected="false" id=":r2:" aria-controls=":r4:" data-orientation="horizontal">Tab 2</button>
  </div>
  <div className="base--horizontal" role="tabpanel" tabindex="0" id=":r3:" aria-labelledby=":r1:" data-orientation="horizontal" data-selected="true">
    Panel 1
  </div>
  <div className="base--horizontal" role="tabpanel" tabindex="0" id=":r4:" hidden aria-labelledby=":r2:" data-orientation="horizontal">
    Panel 2
  </div>
</div>

Components

Root

Rendered element: div

prop type default description
value number | string  
orientation vertical | horizontal horizontal
children      
defaultValue number | string  
direction ltr | rtl ltr
onChange (event, newValue) ⇒ void    
selectionFollowsFocus boolean true Moved to the List

List

Rendered element: div

prop type default description
children      
loop boolean true Configure whether focus loops through tabs or stops at the first/last tab.
activateOnFocus boolean true Formerly selectionFollowsFocus

Tab

Rendered element: button

prop type default description
children      
value number string  
disabled boolean false  

Panel

Rendered element: div

prop type default description
children      
value number string  

Search keywords:

@michaldudak michaldudak added component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature labels Mar 21, 2024
@michaldudak michaldudak self-assigned this Mar 21, 2024
@colmtuite colmtuite moved this from Backlog to In progress in Base UI Alpha Mar 21, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Base UI Alpha Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant