-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DCOS-54459: feat(tabs): add tabs component (#338)
DCOS-54459: feat(tabs): add tabs component
- Loading branch information
Showing
10 changed files
with
349 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Tabs Name | ||
|
||
State of the Tabs is controlled with in the component. | ||
|
||
Example Component: | ||
|
||
```JS | ||
class Example extends React.Component<{}, Partial<{ selectedIndex: number }>> { | ||
state = { selectedIndex: 0 }; | ||
handleSelect = selectedIndex => { | ||
this.setState({ selectedIndex }); | ||
}; | ||
render() { | ||
const { selectedIndex } = this.state; | ||
return ( | ||
<Tabs selectedIndex={selectedIndex} onSelect={this.handleSelect}> | ||
<TabItem> | ||
<TabTitle>Tab 1 Name</TabTitle> | ||
First tab Content | ||
</TabItem> | ||
<TabItem> | ||
<TabTitle>Tab 2 Name</TabTitle> | ||
Second Tab Content | ||
</TabItem> | ||
</Tabs> | ||
); | ||
} | ||
} | ||
``` | ||
|
||
Under the hood we are using [react-tabs](https://github.com/reactjs/react-tabs) |
Oops, something went wrong.