Skip to content

gabsnery/senior-fe-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

senior-fe-challenge

Test Challenge: Tabulator Component

Working

Animação

Install

npm i senior-fe-challenge

The component gives the possibility to function as controlled or uncontrolled.

Controlled

  import { Tab, TabPane } from 'senior-fe-challenge'
  
  function App() {
  
    const [activeTab, setactiveTab] = useState('First Pane');
    
    const onActiveChange = (e: any) => {
        setactiveTab(e);
    }
    
    return(
      <Tab active={activeTab} onActiveChange={onActiveChange}> 
        <TabPane title="First Pane">
          First Pane Body
        </TabPane>
        <TabPane title="Second Pane">
          Second Pane Body
        </TabPane>
      </Tab>
    );
    
 }

Unontrolled

  import { Tab, TabPane } from 'senior-fe-challenge'
  
  function App() {
    return(
      <Tab initialActive={'First Pane'} > 
        <TabPane title="First Pane">
          First Pane Body
        </TabPane>
        <TabPane title="Second Pane">
          Second Pane Body
        </TabPane>
      </Tab>
    );
    
 }

Passing active and initialActive props at the same time will be a type error.

Props

TabPaneProps

Name Mandatory Type Default value Description
title true string Panel's title

TabProps

Name Mandatory Type Default value Description
children true React.ReactElement[] Panels
initialActive false string When uncontrolled, title of first tab to render
active false string When controlled, title of current tab selected
onActiveChange false (e: any) => void function called when component controlled that return the title of selected Tab

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published